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

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

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";
                }
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.