Hello , I want to ask question in C#
This is my own code
----------------------------------
private void button1_Click(object sender, EventArgs e)
{
SqlDataAdapter sda;
DataSet ds;
SqlCommand command = new SqlCommand();
SqlConnection con = new SqlConnection("data source=ISLAM;database=Shop;integrated security=true;");
con.Open();
command.Connection = con;
command.CommandText = "sss";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Clear();
command.Parameters.AddWithValue("@number", textBox1.Text);
command.Parameters.AddWithValue("@size", textBox2.Text);
sda = new SqlDataAdapter("select Number , Size , price from PrimaryTable where Number ="
+ textBox1.Text + " and Size =" + textBox2.Text + "and Quantity > 0", con);
ds = new DataSet();
int s = sda.Fill(ds, "primary");
dataGridView1.DataSource = ds.Tables[0];
int r = command.ExecuteNonQuery();
con.Close();
}
------------------------------------------
here when insert into textboxs ( means passes the parameter for stored proceduer & select )
& when click to the button , do the actions in stored and select the record in datagridview in Row[0]
but when click again to the button with another inputs , replace the new record with the old record "mean show it in Row[0]"!
**I want to show me the all record in datagridview started with Row[0] and the next record in Row[1] .... etc
"i mean when insert into 2 textboxs and click the button show me the record in Row[0]
and then insert another inputs show me the new record in Row[1] not in row[0] ..... etc"
& thanks
This is my own code
----------------------------------
private void button1_Click(object sender, EventArgs e)
{
SqlDataAdapter sda;
DataSet ds;
SqlCommand command = new SqlCommand();
SqlConnection con = new SqlConnection("data source=ISLAM;database=Shop;integrated security=true;");
con.Open();
command.Connection = con;
command.CommandText = "sss";
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Clear();
command.Parameters.AddWithValue("@number", textBox1.Text);
command.Parameters.AddWithValue("@size", textBox2.Text);
sda = new SqlDataAdapter("select Number , Size , price from PrimaryTable where Number ="
+ textBox1.Text + " and Size =" + textBox2.Text + "and Quantity > 0", con);
ds = new DataSet();
int s = sda.Fill(ds, "primary");
dataGridView1.DataSource = ds.Tables[0];
int r = command.ExecuteNonQuery();
con.Close();
}
------------------------------------------
here when insert into textboxs ( means passes the parameter for stored proceduer & select )
& when click to the button , do the actions in stored and select the record in datagridview in Row[0]
but when click again to the button with another inputs , replace the new record with the old record "mean show it in Row[0]"!
**I want to show me the all record in datagridview started with Row[0] and the next record in Row[1] .... etc
"i mean when insert into 2 textboxs and click the button show me the record in Row[0]
and then insert another inputs show me the new record in Row[1] not in row[0] ..... etc"
& thanks