从文本框用户输入向数据表添加数据

时间:2017-06-14 14:37:38

标签: vb.net

当我运行项目时,我将值添加到我想要进入数据表的文本框中,但是当我检查它时,它没有来自文本框或新行的新输入数据。任何人都知道我错过了将数据输入我的数据表的内容吗?这是我的示例代码:

  Dim lineTable As Data.DataTable = New Data.DataTable("NAFTALineItems")

    lineTable.Columns.Add("NAFTAID")
    lineTable.Columns.Add("NAFTALineID")
    lineTable.Columns.Add("BoxQuantity")
    lineTable.Columns.Add("Weight")
    lineTable.Columns.Add("PartNumber")
    lineTable.Columns.Add("PartDescription")
    lineTable.Columns.Add("QuantityShipped")
    lineTable.Columns.Add("UnitPrice")
    lineTable.Columns.Add("TotalPrice")

    Dim lineRow As DataRow = lineTable.NewRow()
    lineRow("NAFTAID") = txtNaftaID.Text
    lineRow("NAFTALineID") = txtLineID.Text
    lineRow("BoxQuantity") = txtQuantity.Text
    lineRow("Weight") = txtWeight.Text
    lineRow("PartNumber") = txtPartNumber.Text
    lineRow("PartDescription") = txtPartDescription.Text
    lineRow("QuantityShipped") = txtQtyShipped.Text
    lineRow("UnitPrice") = txtPrice.Text
    lineRow("TotalPrice") = txtQtyShipped.Text * txtPrice.Text

0 个答案:

没有答案