Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
byteconnector
Starting Member
3 Posts |
Posted - 2008-06-05 : 11:56:00
|
| i have made a windows applicatioon and connect to a database but when i enter the data and presss the button then it did not save the data in database so what should i do ,here i m writing the whole code and please help me and solve this problemprivate void button1_Click(object sender, EventArgs e) { SqlConnection CON = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True;User Instance=True"); CON.Open(); //cm = new SqlCommand("INSERT INTO Student(RegNumber, Name, FatherName) Values ('" + txt_Registration_Number.Text + "','" + txt_Name.Text + "','" + txt_Father_Name.Text + "')", CON); SqlCommand cm = new SqlCommand(); cm = new SqlCommand("INSERT INTO Student(RegNumber, Name) values(1000, 'Hasan Nizamani')", CON); cm.ExecuteNonQuery(); CON.Close(); }sheraz |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-06-05 : 13:04:18
|
| Are you getting an error?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Database maintenance routines:http://weblogs.sqlteam.com/tarad/archive/2004/07/02/1705.aspx |
 |
|
|
|
|
|