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 the difference between proc. Sent by val and by sub?

0 Answers  


Is vs as c#?

0 Answers  


Can we store different data types in arraylist in c#?

0 Answers  


How to find Percentage, name ,College from a resume or document ? How to export these values to other page in C#?

0 Answers   CDC,


What is type safe code?

0 Answers  


how to use msflexgrid in asp.net

1 Answers   nSoft, Unichem,


Why multiple inheritance is not possible in c#

8 Answers  


What are the 3 logical operators?

0 Answers  


What is data reader in c#?

0 Answers  


How does c# generics and c++ templates compare?

0 Answers  


What is the output of TextWriterTraceListener redirected?

0 Answers   Siebel,


Does console.writeline() stop printing when it reaches a null character within a string?

0 Answers  


Categories