Vicomi


public void insertCustomer(string name, string house, string street, string city, string tel1, string tel2, int crediLimit, int currentCredt)
    {
        SqlConnection conn = new SqlConnection(Connection.connectionString);
        conn.Open();

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = "insert into Customer values ('"+name+"','"+house+"','"+street+"','"+city+"','"+tel1+"','"+tel2+"',"+crediLimit+","+currentCredt+");";
        cmd.ExecuteNonQuery();

        conn.Close();
    }

    public void deleteCustomer(string name)
    {
        SqlConnection conn = new SqlConnection(Connection.connectionString);
        conn.Open();

        SqlCommand cmd = conn.CreateCommand();
        cmd.CommandText = "delete from Customer where name='"+name+"'";
        cmd.ExecuteNonQuery();

        conn.Close();
    }
------------------------------------------------------------------------------------------------

Delete   =================================
-------------------------------------------------------------------
 protected void Button1_Click(object sender, EventArgs e)
    {
        DbAccess dba = new DbAccess();

   

        string name = GridView1.SelectedValue.ToString();

       

        dba.deleteCustomer(name);
    }

----------------------------- Fill Culumns ----------------------------------------

protected void Button3_Click(object sender, EventArgs e)
    {
        GridViewRow row = GridView1.SelectedRow;
        TextBox1.Text = row.Cells[1].Text;
        TextBox2.Text = row.Cells[2].Text;
        TextBox3.Text = row.Cells[3].Text;
        TextBox4.Text = row.Cells[4].Text;
        TextBox5.Text = row.Cells[5].Text;
        TextBox6.Text = row.Cells[6].Text;
        TextBox7.Text = row.Cells[7].Text;
        TextBox8.Text = row.Cells[8].Text;
    }
--------------------------------------------------------------

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Vicomi

cmt

Contact Form

Name

Email *

Message *

Dialog

    Popular Post

    Blogger templates

    Powered by Blogger.

    - Copyright © Testing -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -