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 / anand

SqlConnection con = new SqlConnection();

con.ConnectionString = "data source=anand\\sqlexpress.
initial catalog=Database1;integrated security=sspi;";

SqlCommand myCommand = new SqlCommand();

myCommand.CommandText = "Insert into
usr(firstname,lastname,dob,phno,email,Address,state,bgroup)
Values('" + firstname.Text + "','" + lastname.Text + "'," +
dob.Text + "," + phno.Text + ",'" + email.Text + "','" +
Address.Text + "','" + state.Text + "','" + bgroup.Text + "')";

myCommand.Connection = con;

con.Open();

myCommand.ExecuteNonQuery();

con.Close();

Is This Answer Correct ?    5 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you debug your.net application?

1004


Why and where this web.config file is used?

1079


Explain the advantages of asp.net.

995


Can we add code files of different languages in app_code folder?

1093


Explain the main differences between asp and asp.net?

1020


What is the difference between response.redirect and server.transfer?

1031


Explain State management in asp.net

1082


What is scope of an application variable in asp.net?

987


Define the term Scavenging in Caching?

1034


Explain the Order of events in an asp.net page?

1016


What are the authentication types in asp.net?

1048


What is difference between abstract class and an interface?

937


How is mvc different from asp.net? : Asp.Net MVC

1044


Why would a company use an application service provider?

911


What is paging in context of Memory?

1104