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...

How to Insert a TextBox value in to Sql database using C#
coding?

Answer Posted / jegan

SqlConnection con = new SqlConnection();
con.ConnectionString = "connection string(path)";
try
{
con.Open();
SqlCommand cmd = new SqlCommand("insert into emp_detail values(' " + tb1.Text + " ',' " + tb2.Text + " ',' " + tb3.Text + " ')", con);
cmd.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}

Is This Answer Correct ?    66 Yes 26 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are Master Pages in ASP.NET? or What is a Master Page?

1209


What is the difference between c# and .net?

1097


What is data cache in sql server?

1162


Define view state.

986


How you will handle session when deploying application in more than a server?

1149


What is a user session?

928


To display data in a Repeater control which template you provide?

1086


Is asp.net and .net same?

1015


Is global asax mandatory?

1040


can any one find and tell the difference between dot net and php which one is best ? which one we get more salary? which one is stable and which one is best for freshers and also better in future and carrer ? which one we wil get more salary sir ? please send ur valuable suggestions to kiranpulsar2007@gmail.com

2038


What is the viewstate in asp.net?

1102


What is user control in asp.net?

1144


What are type/key pairs in client script registration? Can there be 2 scripts with the same type/key pair name?

990


How you can stop the validation of ASP.NET controls from client side?

1091


Can the dictionary object be created in client?s scope ?

2484