How to Insert a TextBox value in to Sql database using C#
coding?
Answer Posted / anand
SqlConnection con = new SqlConnection();
con.ConnectionString = "data source=anand\\sqlexpress.
initial catalog=Database1;integrated security=sspi;";
SqlCommand myCommand = new SqlCommand();
myCommand.CommandText = "Insert into
usr(firstname,lastname,dob,phno,email,Address,state,bgroup)
Values('" + firstname.Text + "','" + lastname.Text + "'," +
dob.Text + "," + phno.Text + ",'" + email.Text + "','" +
Address.Text + "','" + state.Text + "','" + bgroup.Text + "')";
myCommand.Connection = con;
con.Open();
myCommand.ExecuteNonQuery();
con.Close();
| Is This Answer Correct ? | 5 Yes | 4 No |
Post New Answer View All Answers
List the major built-in objects in asp.net?
Define a multilingual website?
What are validator? How do you disable them?
What are ASHX files?
Is asp.net easy to learn?
To display data in the combo box, prior to setting the Data Source, what kind of property on a Combo Box do you set with a column name?
What are the two properties that are common on every validation control?
What are the different types of proxy patterns?
Explain diff. Betn dataset and recordset?
What is an asp.net web form?
What is difference between session and cookies in asp net?
What is the behavior of a Web browser when it receives an invalid element?
What are the navigation ways between pages available in ASP.NET?
What is session in asp.net?
What is caching? What are different ways of caching in asp.net?