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
What are the server control tags in asp.net.?
What is viewstate information stored?
What is the used of "ispostback" property?
Differentiate between file-based dependency and key-based dependency.
How can you handle errors in Web API?
What does clearing cache?
What are the different types of cookies in asp.net?
What are the parts of an http response?
What do you mean by serialize and marshalbyref?
Can the validation occurs in server-side or client-side? If the validation occurs why should we do?
What is the part of url?
Which .NET framework supports Web API?
What is Cookies Less Session?
What is ipostback?
Suppose You Want A Certain Asp.net Function Executed On Mouseover For A Certain Button. Where Do You Add An Event Handler?