不知道错误在哪儿?“不说也罢”请帮忙
错误出现在保存数据库时出现,不知道错在哪里?Imports System.Data
Imports System.Data.OleDb
Public Class Form1
Dim objconnection As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\规管数据库\shujuku.accdb")
Dim objdataadapter As New OleDbDataAdapter("SELECT * FROM biao ORDER BY 序号", objconnection)
Dim objdataview As DataView
Dim objdataset As DataSet
Dim objcurrencymanager As CurrencyManager
end sub
Private Sub filldatasetandview()
objdataset = New DataSet
objdataadapter.Fill(objdataset, "biao")
objdataview = New DataView(objdataset.Tables("biao"))
objcurrencymanager = CType(Me.BindingContext(objdataview), CurrencyManager)
End Sub
Private Sub mydtgr() '绑定datagridview
grdauthortitles.AutoGenerateColumns = True
grdauthortitles.DataSource = objdataview
Dim objalternatingcellstyle As New DataGridViewCellStyle
objalternatingcellstyle.BackColor = Color.WhiteSmoke
grdauthortitles.AlternatingRowsDefaultCellStyle = objalternatingcellstyle
Private Sub wbkbangding() '绑定文本框
TextBox47.DataBindings.Add("text", objdataview, "序号")
TextBox52.DataBindings.Add("text", objdataview, "备份备注")
TextBox54.DataBindings.Add("text", objdataview, "批准项目机构")
TextBox53.DataBindings.Add("text", objdataview, "日期")
TextBox56.DataBindings.Add("text", objdataview, "X用地规模")
TextBox55.DataBindings.Add("text", objdataview, "J道路红线")
TextBox57.DataBindings.Add("text", objdataview, "D该用地")
建设单位TextBox1.DataBindings.Add("text", objdataview, "建设单位")
....全部列
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click 'datagridview添加新行
objdataview.AddNew()
objcurrencymanager.Position = objcurrencymanager.Count - 1
showposition()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click ’保存数据库
Dim objcommand As New OleDbCommand
Dim intposition As Integer
intposition = objcurrencymanager.Position
objcommand.Connection = objconnection
= "update biao " & _
"set D该用地=TextBox57,X用地规模=TextBox56,J道路红线=TextBox55,批准项目机构=TextBox54, .....全部列 where 序号=TextBox47"
= CommandType.Text
objcommand.Parameters.AddWithValue("D该用地", TextBox57.Text)
objcommand.Parameters.AddWithValue("X用地规模", TextBox56.Text)
objcommand.Parameters.AddWithValue("J道路红线", TextBox55.Text)
objcommand.Parameters.AddWithValue("批准项目机构", TextBox54.Text)
objcommand.Parameters.AddWithValue("日期", TextBox53.Text)
objcommand.Parameters.AddWithValue("序号", TextBox47.Text)
objcommand.Parameters.AddWithValue("建设单位", 建设单位TextBox1.Text)
objcommand.Parameters.AddWithValue("X项目名称", X项目名称TextBox.Text)
objcommand.Parameters.AddWithValue("X建设项目依据", X建设项目依据TextBox.Text)
objcommand.Parameters.AddWithValue("X附图名称", X附图名称TextBox.Text)
.....全部列
objconnection.Open()
objcommand.ExecuteNonQuery()
objconnection.Close()
filldatasetandview()
binddfields()
objcurrencymanager.Position = intposition
wbkguan()
End Sub