Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
inserting 10-12 items from listbox into sql database
anurag guhe
Jul 13 2016 7:10 AM
225
Reply
hi guys...I am developing windws form & in that form 1 is combox , 1 listbox & 1 button .... listbox containg items after selecting items from combobox now i want when i clicking on save button how should i am inserting the all items from listbox into sql database...here following is my code
private void Btn_Save_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConnectionString);
con.Open();
str = "insert into Customer_Entery_Form values('"+Lst_Bx_Service_Name.Items.ToString()+ "')";
com = new SqlCommand(str, con);
com.ExecuteNonQuery();
con.Close();
MessageBox.Show("Records successfully Inserted");
Lst_Bx_Staff_Name.Items.Clear();
}
now the problem is that data is inserting successfully from listbox but when i am showing in sql database it shows like "
System.Windows.Forms.ListBox+ObjectCollection
"
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
how to Parse the following XML and generate HTML code in pr
How to make send sms to mobile use pc