TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
apeterson
NA
12
0
Binding CheckBoxList to Database and the returning a SQL statement
Dec 27 2004 10:52 AM
I am trying to populate a checkboxlist with the names of clients from a database. From that I would like to generate a sql statement that will include those clients in the update query. So what I am looking to do is for an administrator to come in and see a list of the clients that are in the database and then be able to upload a file and select which one of the clients will be able to see the file. I have the authentication working and have a page that will allow the user to upload files but I am still trying to figure this out. So far I was able to bind the checkboxlist to the database and display the values, but being new to C# I am unable to figure out how to generate this sql statement that would include what clients the admin checked. Here is the code as of right now: private void Page_Load(object sender, System.EventArgs e) { CheckBoxList1.DataSource = MyQueryMethod(); CheckBoxList1.DataValueField = "ClientName"; CheckBoxList1.DataTextField ="ClientName"; CheckBoxList1.DataBind(); } System.Data.DataSet MyQueryMethod() { string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\\Inetpub\\wwwr" + "oot\\LandFormFileProject\\LoginClients.mdb"; System.Data.IDbConnection dbConnection = new System.Data.OleDb.OleDbConnection(connectionString); string queryString = "SELECT [clients].[clientName] FROM [clients]"; System.Data.IDbCommand dbCommand = new System.Data.OleDb.OleDbCommand(); dbCommand.CommandText = queryString; dbCommand.Connection = dbConnection; System.Data.IDbDataAdapter dataAdapter = new System.Data.OleDb.OleDbDataAdapter(); dataAdapter.SelectCommand = dbCommand; System.Data.DataSet dataSet = new System.Data.DataSet(); dataAdapter.Fill(dataSet); return dataSet; }
Reply
Answers (
0
)
I am navigated to the INTRO instead of the page I want
insert into dbf files from asp.net