01.
strSQL =
"INSERT INTO MT_FLST_QT_QUOTATION (quotation_no,port_id,STARTDATE,STOPDATE) "
+
02.
"VALUES (@qn,@port,@start,@stop)"
;
03.
strSQLupdate =
"UPDATE MT_FLST_QT_QUOTATION SET quotation_no=@qn,port_id=@port,STARTDATE=@start,STOPDATE=@stop WHERE std_quation_id='"
+ qt_no.Text +
"' "
;
04.
05.
objCmd =
new
SqlCommand(strSQL, objConn);
06.
objCmdupdate =
new
SqlCommand(strSQLupdate, objConn);
07.
08.
09.
10.
11.
12.
13.
14.
for
(
int
i = 0; i < dataGridView1.Rows.Count; i++)
15.
{
16.
objCmd.Parameters.AddWithValue(
"@qn"
, dataGridView1.Rows[i].Cells[0].Value);
17.
objCmd.Parameters.AddWithValue(
"@port"
, dataGridView1.Rows[i].Cells[1].Value);
18.
objCmd.Parameters.AddWithValue(
"@start"
, date_start.Text);
19.
objCmd.Parameters.AddWithValue(
"@stop"
, date_stop.Text);
20.
21.
objCmdupdate.Parameters.AddWithValue(
"@qn"
, dataGridView1.Rows[i].Cells[0].Value);
22.
objCmdupdate.Parameters.AddWithValue(
"@port"
, dataGridView1.Rows[i].Cells[1].Value);
23.
objCmdupdate.Parameters.AddWithValue(
"@start"
, date_start.Text);
24.
objCmdupdate.Parameters.AddWithValue(
"@stop"
, date_stop.Text);
25.
objCmd.Parameters.Clear();
26.
}
27.
objCmd.ExecuteNonQuery();
28.
29.
objConn.Close();
30.
objConn =
null
;