Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click
If btnadd.Text = "Add" Then
txtid.Text = ""
txtname.Text = ""
txttelno.Text = ""
txtaddress.Text = ""
txtemail.Text = ""
btnadd.Text = "Confirm"
MessageBox.Show("Add the information and then Click the confirm", "check", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
If btnadd.Text = "Confirm" Then
Dim currentPos As Integer = ps.Position
If MessageBox.Show("Are you sure to add", "Confirm", MessageBoxButtons.OKCancel) = DialogResult.OK Then
Dim id As String = "'" & txtid.Text & "'"
Dim name As String = "'" & txtname.Text & "'"
Dim telno As String = "'" & txttelno.Text & "'"
Dim Address As String = "'" & txtaddress.Text & "'"
Dim Email As String = "'" & txtemail.Text & "'"
Dim addstr As String
addstr = "insert into Company(companyID,companyName,telNo,address,email) values("
addstr = addstr & id & "," & name & "," & telno & "," & Address & "," & Email & ")"
OleDbConnection1.Open()
OleDbDataAdapter1.InsertCommand.CommandText = addstr
OleDbDataAdapter1.InsertCommand.ExecuteNonQuery()这句错误
DataSet11.Clear()
OleDbDataAdapter1.Fill(DataSet11)
ps.Position = ps.Count - 1
OleDbConnection1.Close()
Else
DataSet11.Clear()
OleDbDataAdapter1.Fill(DataSet11)
ps.Position = currentPos
End If
btnadd.Text = "Add"
End If
End Sub
请达人帮看看哪里错了.我是新手..一直找不出哪里错了.