protected void btndel_Click(object sender, EventArgs e)
    {
        SqlConnection con123 = new SqlConnection();
        con123.ConnectionString = @"Data Source=viral\sqlexpress;Initial Catalog=mydata23;Integrated Security=True";

        string qu1 = "delete from table_1 where (username='" + txtuser.Text + "', password='" + Txtpass.Text + "')";



        SqlCommand dsa = new SqlCommand(qu1, con123);

        con123.Open();

        dsa.ExecuteNonQuery();


        con123.Close();
        Response.Write("deleted");
    }

SqlConnection con123 = new SqlConnection();

        con123.ConnectionString = @"Data Source=viral\sqlexpress;Initial Catalog=mydata23;Integrated Security=True";



SqlConnection con123 = new SqlConnection();
        con123.ConnectionString = @"Data Source=viral\sqlexpress;Initial Catalog=mydata23;Integrated Security=True";

        string qu1 = "delete from table_1 where (username='" + txtuser.Text + "', password='" + Txtpass.Text + "')";



        SqlCommand dsa = new SqlCommand(qu1, con123);

        con123.Open();

        dsa.ExecuteNonQuery();


        con123.Close();
        Response.Write("deleted");



    string qu1 = "delete from table_1 where (username='" + txtuser.Text + "', password='" + Txtpass.Text + "')";



    SqlCommand dsa = new SqlCommand(qu1, con123);

    con123.Open();

    dsa.ExecuteNonQuery();


    con123.Close();
    Response.Write("deleted");

Can you provide more information starting with what the error you are getting is?

change your query of delte .....
string qu1 = "delete from table_1 where username='" + txtuser.Text + "'and password='" + Txtpass.Text + "'"

You shuld have specify your exact errors, because different errors have different solutions. Your solution is on the way just try to ask once again........

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.