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 |
What is the difference between proc. Sent by val and by sub?
Is vs as c#?
Can we store different data types in arraylist in c#?
How to find Percentage, name ,College from a resume or document ? How to export these values to other page in C#?
What is type safe code?
how to use msflexgrid in asp.net
Why multiple inheritance is not possible in c#
What are the 3 logical operators?
What is data reader in c#?
How does c# generics and c++ templates compare?
What is the output of TextWriterTraceListener redirected?
Does console.writeline() stop printing when it reaches a null character within a string?
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)