主题:找singleminded,,求助!!!
Dim MyDataSet As New DataSet
Dim MyODA As OleDb.OleDbDataAdapter
Dim Conn As String = "provider=Microsoft.jet.oledb.4.0;data source =学籍管理数据库.mdb"
Dim MyConn As New OleDb.OleDbConnection(Conn)
MyConn.Open()
Dim selstr As String = "select * from users"
Dim addstr As String = "insert into users (帐号,密码) values (" & TextBox1.Text & "," & TextBox2.Text & ")"
MyODA = New OleDb.OleDbDataAdapter(selstr, MyConn)
MyODA.InsertCommand.CommandText = addstr
MyODA.InsertCommand.CommandType = CommandType.Text
MyODA.InsertCommand.ExecuteNonQuery()
MyODA.TableMappings.Add("Table", "users")
MyODA.Fill(MyDataSet, "users")
DataGrid1.DataSource = MyDataSet.Tables("users")
MyConn.Close()
这段代码那错了。。。。帮我看看。。我总是添不进去记录
Dim MyODA As OleDb.OleDbDataAdapter
Dim Conn As String = "provider=Microsoft.jet.oledb.4.0;data source =学籍管理数据库.mdb"
Dim MyConn As New OleDb.OleDbConnection(Conn)
MyConn.Open()
Dim selstr As String = "select * from users"
Dim addstr As String = "insert into users (帐号,密码) values (" & TextBox1.Text & "," & TextBox2.Text & ")"
MyODA = New OleDb.OleDbDataAdapter(selstr, MyConn)
MyODA.InsertCommand.CommandText = addstr
MyODA.InsertCommand.CommandType = CommandType.Text
MyODA.InsertCommand.ExecuteNonQuery()
MyODA.TableMappings.Add("Table", "users")
MyODA.Fill(MyDataSet, "users")
DataGrid1.DataSource = MyDataSet.Tables("users")
MyConn.Close()
这段代码那错了。。。。帮我看看。。我总是添不进去记录