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 |
How many digits is a 32 bit number?
What do you understand by an Implicit Variable?
Explain how is the dll hell problem solved in .net?
How does it work?
What is GAC?
what is generics? can u explain 5 to 6 examples on generics that covers class,method,structure,list,delegates?
What is the diff between the System.Array.CopyTo() and System.Array.Clone()?
What is the difference between list and arraylist c#?
C# is case sensitive, what is mean by case sensitive
What is difference between internal and protected internal in c#?
What is an arraylist in c#?
What is object type in c#?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)