quantity
データベースの列を、最初にデータがロードされている datagridview に配置したいと考えていますquantity
。今quantity
、データベースに列をロードしようとしました。これが私のコードです:
using (MySqlConnection con = new MySqlConnection(serverstring))
{
string query = @"SELECT quantity
FROM tblOrder_Products
WHERE order_ID=@ID";
con.Open();
using (MySqlCommand cmd = new MySqlCommand(query, con))
{
DataTable dt = new DataTable();
cmd.Parameters.AddWithValue("@ID", txtboxID.Text);
MySqlDataReader dr = cmd.ExecuteReader();
dt.Load(dr);
dr.Close();
dataGridView2.DataSource = dt;
// I want to change this line or this part of code because
// I want to put only the column `quantity` which means
//retaining the data loaded previously in the datagridview
}
だから私の質問は、以前にロードされたものを削除または上書きせずに、どのようにデータグリッドビューに配置するのですか?