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
How can you debug your.net application?
Why and where this web.config file is used?
Explain the advantages of asp.net.
Can we add code files of different languages in app_code folder?
Explain the main differences between asp and asp.net?
What is the difference between response.redirect and server.transfer?
Explain State management in asp.net
What is scope of an application variable in asp.net?
Define the term Scavenging in Caching?
Explain the Order of events in an asp.net page?
What are the authentication types in asp.net?
What is difference between abstract class and an interface?
How is mvc different from asp.net? : Asp.Net MVC
Why would a company use an application service provider?
What is paging in context of Memory?