How to Insert a TextBox value in to Sql database using C#
coding?
Answer Posted / balakumar
string strconn = @"Data Source=localhost;
Initial Catalog=Bala;
Trusted_Connection=yes;";
SqlConnection conn = new SqlConnection(strconn);
conn.Open();
string insertcommand = "insert into Employee
values('" + TextBox1.Text + "','" + TextBox2.Text + "','" +
TextBox3.Text + "')";
SqlCommand cmd = new SqlCommand(insertcommand, conn);
cmd.ExecuteNonQuery();
conn.Close();
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
I have created a configuration setting in my web.config and have kept it at the root level. How do I prevent it from being overridden by another web.config that appears lower in the hierarchy?
How to make paging concepts in datagrid in ASP.NET?
What are the advantages of using sql stored procedures instead of adhoc sql queries in an asp.net web application?
Where is http session stored?
How is application management and maintenance improved in asp.net 2.0?
In a Repeater control how one can provide an alternating color scheme ?
What are merge modules?
What tags do you need to add within the asp:datagrid tags to bind columns manually? Give an example.
Explain http handlers? Where we can use the http handlers?
What is state management in asp.net with example?
What is a session in asp.net?
What are the two properties that are common on every validation control?
I have an external link in my application say www.xyztest.com. Today this site works on http protocal. Tommorow it may run on https. So i cant hardcore the protocal in the site. When a user clicks on the link how can i know if the external site works on http or https and takes him to that place?
What’s the difference between asp.net web forms and asp.net mvc?
Explain how can you debug your .net application?