8 Years
Discussion Span
Last Post by mail2saion

What type of help required? Do you know how to write code.

Few steps you can follow:

Open vs. Go to file-->new-->website.
Then you found a default.aspx page.
now from tool box add some labels & textbox + a button to save data.

Now run the project will prompt you to create web.config file.

in the web.config file remove the <connectionstring/> line & paste the below code:

<add name="TestConnection" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=TESTDB;Trusted_Connection=yes;"
      providerName="System.Data.SqlClient" />

Just modify the database name by removing the TESTDB.

under button click event:
Write the insert statement to insert data in the below way.

String sConstr=ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString;
SqlConnection conn = new SqlConnection(sConstr);
SqlCommand comm = new SqlCommand("INSERT INTO TABLE(col1,col2) VALUES(TextBox1.Text,TextBox2.Text)", conn);
// If data type varchar then pad single quotation after & before the TextBox value.

Let me know if you need further information.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.