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 can you implement encapsulation in asp.net?
Contrast oop and soa. What are tenets of each16. How does the xmlserializer work? What acl permissions does a process using it require?
Explain the use of fragment caching.
What is the difference between page-level caching and fragment caching?
How many types cache in asp net?
What is a web api? Which protocol is used in a web api?
What is skin in asp.net?
How ASP and ASP.NET page works? Explain about asp.net page life cycle?
What is the difference between cookie and session?
What is rich control in asp.net?
What is server side routing?
What is a server farm in iis?
Explain the boxing and unboxing concept in .net?
What are the disadvantages of view state?
They mostly asked difference between versions of technologies