我有連接到datagridview的表,我想通過使用文本框輸入新的數據。我有以下代碼,但它給了我錯誤。將不勝感激,如果你幫我。錯誤消息是:使用「new」關鍵字來創建一個對象實例我的錯誤在哪裏?
Dim meter As DataTable = Me.DataSet1.Tables.Item("tblmeters")
Dim row As DataRow = meter.NewRow()
row.Item("No") = Me.txtno.Text
row.Item("Turnover") = Me.txtturnover.Text
row.Item("Total Win") = Me.txttotalwin.Text
row.Item("Games Played") = Me.txtgamesplayed.Text
row.Item("Credit In") = Me.txtcreditin.Text
row.Item("Bill In") = Me.txtbillin.Text
row.Item("Hand Pay") = Me.txthandpay.Text
row.Item("Date") = DateTime.Today.ToShortDateString
meter.Rows.Add(row)
Me.TblMeterTableAdapter.Update(Me.DataSet1.tblMeter)
meter.AcceptChanges()
請將您的代碼放在代碼中,以便它可讀。 – Moox 2010-06-08 13:11:26
請使用代碼格式。你能給出你得到的具體錯誤信息嗎? – 2010-06-08 13:11:49
並添加錯誤消息 – 2010-06-08 13:12:03