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 are the different types of sessions in asp.net?
What are the versions of garbage collection?
What are web server controls in asp.net?
What is a web api? Which protocol is used in a web api?
What is enableviewstate in asp net?
1.what is the application pool. 2.what is the HttpModile and Http Handler. 3.C# 3.0 Features ? 4.Anonoymous Type,methopd and claas in 3.0? 5.difference between statsic and const ? 6.session vs application 7.state management clint side and server side ? 8.Genric list 9.c# 3.0 vs 3.5
Where web.config file is used?
Explain the different parts that constitute ASP.NET application?
Explain how do you deploy your asp.net application?
What do you mean by authorization?
Explain how caching in asp.net 2.0 is different from caching in asp.net 1.1?
What is the difference between response.redirect and server.transfer?
Define a web service in .net?
What is a multilingual website?
Mention the execution process for managed code?