0

我想做的是生成用户添加到datagridview中的产品列表,但是当我使用datatable.load(datareader)时,它总是重置datatable的先前值,我也尝试了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 和最后一个结果时插入数据表?

4

0 回答 0