0

can anybuddy help to sort out my problem in .net
actually i m beginner at this platform
facing a very crucial error i think so
i m making a web page connectivity to sql database for inserting the data.........
my error name:
Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: Inserting is not supported by data source 'SqlDataSource1' unless InsertCommand is specified.

Source Error:


Line 28: protected void Button1_Click(object sender, EventArgs e)
Line 29: {
Line 30: SqlDataSource.Insert();
Line 31: }
Line 32: }

hope anyone understand ? my this problem

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by shanboy
0

After selecting columns from a table or view, click on "Advanced" button to configure Insert/Delete/Update query.

0

data source is SQL server name
initial catalog is database name
integrated security=true-mode of connectivity

code below is to insert into database(banking_web),table customer
received from textboxes in an aspx form (CustName,UserName andtxtPassword)

protected void btnSubmit_Click(object sender, EventArgs e)
    {

        SqlConnection conn = new SqlConnection("data source=SHAN-50B38D09ED;initial catalog=banking_web;integrated security=true");
            conn.Open();

            
                SqlCommand cmd = new SqlCommand("insert into customer values('" + txtCustName.Text + "','" + txtUserName.Text + "','" + txtPassword.Text + "')", conn);
                int result1 = cmd.ExecuteNonQuery();
                if (result1 == 1)
                {
                    txtMessage.Text = "Successfully Registered";
                }
}
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.