Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
3
Reply
inserting 10-12 items from listbox into sql database
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
anurag guhe
8y
245
1
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
"
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