i need to insert data into sql server table emp through
textboxes txtname and txtsalary using c# code. Please help
Answer Posted / suresh
open the Sqlconnection and write the connection string dere
and take one sqldata Adapter and also take one datatable
write the following code.
sqlconnection con=new sqlconnection("server=.; user Id=sa;
Password=sa123; Database=emp");
sqlDataAdapter da;
DataTable dt;
In Button Click Event you write this code
da=new sqlDataAdapter("insert into Emp(EmpID,Ename) values
('"+textbox1.Text+"','"+textbox2.Text+"'",con);
dt=new DataTable();
da.Fill(dt);
That's it you entered the Data into SQL Server
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
What is a template class?
How you will create satellite assemblies?
In .Net, what is an assembly? Also explain the type of assembly.
What is difference between array and arraylist c#?
Which is faster hashtable or dictionary?
What is state c#?
What is the execution entry point for a c# console application?
What is getenumerator?
What are concrete classes?
What is private class in c#?
4. Describe the process when we send a request URL? And who is responsible for that?
What is dependency in software?
What does async mean in c#?
What are All kind of access specifiers for a class and for methods
To create a localized application which namespaces are necessary?