How to Insert a TextBox value in to Sql database using C#
coding?
Answer Posted / jeevananth
try
{
SqlConnecion cn=new SqlConnection("Data
source=.;database=Studentdetail;uid=sa;pwd=sa");
SqlCommand cmd=new SqlCommand();
cn.Open();
string qry;
qry="insert into Table values('"+ TextBox1.Text +"','"+
TextBox2.Text +"')";
cmd=new(qry,cn);
cmd.cmd.ExecuteNonQuery();
cn.Close();
}
catch(Exception ex)
{
Responce.Write(ex.Message.ToString());
}
| Is This Answer Correct ? | 0 Yes | 6 No |
Post New Answer View All Answers
what is DLL Hell and how it is solved in .NET? please explain clearly??
What is rending process in ASP.NET?
How to retrieve user name in case of Window Authentication?
What is application state?
What is asp.net ajax?
Which asp.net objects encapsulate the state of the client and the browser?
Why is global asax is used for?
How can we apply themes to an asp.net application?
They mostly asked difference between versions of technologies
What is another word for redirect?
What are web beacons used for?
Explain exception filters?
Differentiate between structure and class.
How is it possible for .NET to support many languages?
Describe session handling in a webfarm?