Inserting values into the database using a asp.net button click
Expand Post »
Hi all,
I am new to asp.net programming and i have to design a website which should accept values from the user and store it in the databse on a button click event.
I am not able to do it In fact i have written a code for button click the code is as follows:
myCommand = New SqlCommand("Insert into Employee Data values('" & ddlid.selectedItem & "','" & txtname.Text & "','" & ddldesig.selectedItem & "','" & txtcontno.Text & "')", "myConnection")
Last edited by peter_budo; Dec 21st, 2008 at 4:55 am. Reason: Please, either use [code] or [code=asp.net] (or other langiage as necessary). DO NOT USE [QUOTE]
SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["shortycaponeConnectionString"].ConnectionString);
//SqlConnection mySqlConnection = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["shortycaponeConnectionString"].ConnectionString);
//// open the Sql connection
//mySqlConnection.Open();
//DataSet ds = new DataSet();
//SqlDataAdapter da1 = new SqlDataAdapter("Select Quantity from InwardEntries where ProductCode='" + DropDownList4.SelectedItem.Text + "'", mySqlConnection);
SqlConnection con = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["shortycaponeConnectionString"].ConnectionString);
//SqlConnection mySqlConnection = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["shortycaponeConnectionString"].ConnectionString);
//// open the Sql connection
//mySqlConnection.Open();
//DataSet ds = new DataSet();
//SqlDataAdapter da1 = new SqlDataAdapter("Select Quantity from InwardEntries where ProductCode='" + DropDownList4.SelectedItem.Text + "'", mySqlConnection);
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.