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 autopostback in asp net?
Explain About duration in caching technique
Can the validation occurs in server-side or client-side? If the validation occurs why should we do?
Are there any resources for drop-in replacements for the default css that comes with the ASP.NET Website template?
How to do parallel database export in remote SQL Server in ESSL time track. It is working for local server but not working for remote SQL Server
What are the difference between overriding and overloading?
Can you explain architecture of your project ?
How to change Master page in ASP.Net using code?
What is the flow of processing of the request? : asp.net mvc
What is DataGrid wheater its a Server Control or something else ?
What is applicatio domain?
What is IPostBack? How to use it?
Explain Authentication mechanism in dotnet
How many web.config files can I have in an application?
Where can I get information on cookies in asp.net?