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

How will you deploy the dll file in gac?

884


what will be the output of the given below coding. using System; public class Exercise { static void OddNumbers(int a) { if (a >= 1) { Console.Write("{0}, ", a); a -= 2; OddNumbers(a); } } public static int Main() { const int Number = 9; Console.WriteLine("Odd Numbers"); OddNumbers(Number); Console.WriteLine(); return 0; } }

4237


What is the use of functional interface?

864


Why would you use a class property in c#?

866


What is append in c#?

798


What is the difference between int.parse and int.tryparse methods?

993


What is namespace c#?

875


Should I use double or float?

849


What is a statement c#?

904


What is callback in c#?

847


Why do we need to call CG.SupressFinalize?

927


Which of the following operations can you not perform on an ado.net dataset?

925


What are the properties of string?

902


What is the difference between c and c sharp?

931


What is private variable?

838