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

If a child class instance is created, which class constructor is called first - base class or child class?

0 Answers  


What is difference between property and variable in c#?

0 Answers  


What are the advantages of clr procedure over t-sql procedure?

0 Answers  


Is c# lazy thread safe?

0 Answers  


Why is it a bad idea to throw your own exceptions?

4 Answers  


Why should you override the tostring() method?

0 Answers  


What is the Difference between a sub and a function?

3 Answers   Wipro,


Explain constructor?

6 Answers   Wipro,


How to find methods of a assembly file (not using ILDASM)?

0 Answers  


What is literal in c#?

0 Answers  


Is static class thread safe in c#?

0 Answers  


What is difference between variable and property in c#?

0 Answers  


Categories