| | |
problem in inserting data by using checkedlistbox in database
![]() |
•
•
Join Date: Oct 2009
Posts: 5
Reputation:
Solved Threads: 0
C# Syntax (Toggle Plain Text)
private void insertbtn_Click(object sender, EventArgs e) { string name = textBox1.Text.ToString(); string course; for (int i = 0; i < checkedListBox1.CheckedItems.Count; i++) { course += checkedListBox1.CheckedItems[i].ToString() + " "; } string constring = "PROVIDER= MSDAORA;USER ID = SYSTEM; PASSWORD = mca"; string query = "insert into checkapp1 values('" + name + "','" + course+ "')"; cn = new OleDbConnection(constring); cn.Open(); cm = new OleDbCommand(query, cn); cm.ExecuteNonQuery(); MessageBox.Show("data inserted"); }
Last edited by sivananda2009; Oct 20th, 2009 at 8:39 am.
0
#3 Oct 20th, 2009
DdoubleD is right. To elaborate more on the issue take this for example:
Now you're appending a value to s, but what is s? It was never assigned a value thus you have the problem. What you can do:
C# Syntax (Toggle Plain Text)
string s; s += "abc";
Now you're appending a value to s, but what is s? It was never assigned a value thus you have the problem. What you can do:
C# Syntax (Toggle Plain Text)
string s = string.Empty; s += "abc";
![]() |
Similar Threads
- Problem while Inserting and Updating data into MS access (VB.NET)
- Problem while Inserting and Updating data into MS access (VB.NET)
- Problem inserting data into Access database via php (PHP)
- problem in inserting data into the database (PHP)
- Problem with retrieving data from access 2003 (Visual Basic 4 / 5 / 6)
- Inserting Data into Access Database (Java)
Other Threads in the C# Forum
- Previous Thread: Insert and retrieve data using checkedlistbox to/from oracle database using c#.net
- Next Thread: Table columns intellisense in c#
Views: 380 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C#
.net 2d access algorithm application array asp.net assembly bitmap box button c# calculator check checkbox class code color combo combobox connectionproblem control conversion csharp custom data database datagrid datagridview dataset degrees directshow display dll drawing event excel exception expression file form format forms ftp function gcd gdi+ graphics image index input install internet label list listbox listener login math mysql object operator pause photoshop php picturebox pixel print programming remote remoting resource resourcefile saving search server socket sql sql-server statistics stream string text textbox thread threading time timer tutorial update validation vc++ view visual webbrowser webcam windows winforms wpf xml






