i need to insert data into sql server table emp through
textboxes txtname and txtsalary using c# code. Please help
Answer / 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 |
What is the max value of int32 in c#?
What's new in c#?
What is function c#?
What is the difference between dynamic and var in c#?
Why do we use delegates?
What is the difference between static and private constructor in c#?
Explain the feature of c# language?
What is difference between destructor and finalize?
What is the use of "default" and "Using" keyword?
Why ref is used in c#?
Explain how to implement an object pool in c#.net
What is the default modifier for class in c#?