我想要做的是生成用户添加到datagridview中的产品列表,但是因为我使用datatable.load(datareader)它总是重置数据表的先前值,我也试过datatable.load( datareader,upinsert)但同样的事情再次发生。
If e.KeyCode = Keys.Return Then
cn = connectdb("MSMS.mdb", "")
Dim cmd2 As New OleDbCommand("SELECT Code,Product,Pack,Batch,Expiration,Free,MRP,Rate,CST,VAT,CD,SD FROM product WHERE Product ='" + DataGridView2.SelectedRows(0).Cells(0).Value.ToString + "'", cn)
Dim dr2 As OleDbDataReader
Dim dt As New DataTable
dr2 = cmd2.ExecuteReader()
dt.Load(dr2, LoadOption.Upsert)
DataGridView3.DataSource = dt
我希望每次按Enter键和最后一个结果时插入数据表?