Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


i need to insert data into sql server table emp through
textboxes txtname and txtsalary using c# code. Please help



i need to insert data into sql server table emp through textboxes txtname and txtsalary using c# co..

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

Post New Answer

More C Sharp Interview Questions

What is difference between out and ref in c#?

0 Answers  


Which controls do not have events?

0 Answers  


How is the memory managed in C#.

1 Answers  


How to assign Null value to Var?

0 Answers   HCL,


What is the difference between as and is operators in c#?

0 Answers  


What is ildasm and obfuscator in net?

0 Answers  


What is string programming language?

0 Answers  


What is the base class from which all value types are derived?

0 Answers  


Why do we use reflection in c#?

0 Answers  


Define thread?

0 Answers  


How do I enforce const correctness in c#?

0 Answers  


What can I create with c#?

0 Answers  


Categories