这些有什么问题?
我的模块是:
Imports System.Data.OleDb
Module Module1
Public con As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\CITeval\system7\system7\evaluation.mdb")
Public da As OleDbDataAdapter
Public dr As OleDbDataReader
Public cmd As OleDbCommand
Public ds = New DataSet
Public CurrentRow As Integer
Public sql As String
End Module
btn更新
Try
Dim Str As String
Str = "update studentsrecord set IDNumber="
Str += """" & txtIDNumber.Text & """"
Str += " where IDNumber="
Str += txtIDNumber.Text.Trim()
con.Open()
cmd = New OleDbCommand(Str, con)
cmd.ExecuteNonQuery()
con.Close()
con.Open()
Str = "update studentsrecord set FirstName="
Str += """" & txtfirst.Text & """"
Str += " where IDNumber="
Str += txtIDNumber.Text.Trim()
con.Open()
cmd = New OleDbCommand(Str, con)
cmd.ExecuteNonQuery()
con.Close()
con.Open()
Str = "update studentsrecord set LastName="
Str += """" & txtlast.Text & """"
Str += " where IDNumber="
Str += txtfirst.Text.Trim()
cmd = New OleDbCommand(Str, con)
cmd.ExecuteNonQuery()
con.Close()
con.Open()
Str = "UPDATE studentsrecord set Course="
Str += """" & cbocourse.Text & """"
Str += " where IDNumber="
Str += txtIDNumber.Text.Trim()
cmd = New OleDbCommand(Str, con)
cmd.ExecuteNonQuery()
con.Close()
con.Open()
Str = "update studentsrecord set Password="
Str += """" & txtpassword.Text & """"
Str += " where IDNumber="
Str += txtIDNumber.Text.Trim()
cmd = New OleDbCommand(Str, con)
cmd.ExecuteNonQuery()
con.Close()
ds.Clear()
da = New OleDbDataAdapter("SELECT * FROM studentsrecord ORDER BY ID", con)
da.Fill(ds, "evaluation")
MsgBox("Updated Successfully...")
Catch ex As Exception
MsgBox(ex.Message & "," & ex.Source)
Finally
If con.State = ConnectionState.Open Then con.Close()
End Try