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
How does u call and execute a sp in .net?
What are directives in asp.net?
How can you implement the postback property of an asp.net control?
Name the tools or API for developing or testing web api?
Distinguish between Server-side and Client-side code with its functionality?
How could you modify xaml content from javascript?
Why mvc is faster than asp.net? : Asp.Net MVC
How ViewstateMac works?
What is in a session cookie?
Describe how passport authentication works.
What is a ashx file?
What is the difference between ASP.NET Webforms and ASP.NET MVC?
Can more than one person use the same login?
What is considered a service provider?
Give an example of cookie abuse.