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

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


Please Help Members By Posting Answers For Below Questions

what is inheritance and an example in vb.net and c# of when you might use it?

1003


Explain why do I get an error (cs1006) when trying to declare a method without specifying a return type?

870


How do you escape c#?

940


What is the difference between do and while loop?

931


What do constructors do in c#?

1004


Why singleton is sealed?

901


What is a collection in c#?

952


What is the difference between Static, Const and read only?

1121


Enlist all the components of an ado.net framework?

915


What is the difference between static and constant variables?

1128


What is the difference between static class and singleton class in c#?

967


What is “using” statement in c#?

1143


Is there an equivalent to the instanceof operator in visual j++?

1008


hi my question is about understanding a text the user entered to a site , so i want to analyse that text looking for some specific items such as "honda" "shoffere" etc.. so if this site could help or could tell me where to go with such question ,i wonder. thanks

2069


Why do we use interface in c#?

1049