my code for the form load is:
[Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dbProvider = "PROVIDER=Microsoft.ACE.OLEDB.12.0;"
dbSource = "Data Source= C:\users\newton\Documents\wilson.accdb"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT tblLogin.Username, tblLogin.Password FROM tblLogin"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Login")
con.Close()
MaxRows = ds.Tables("Login").Rows.Count
inc = -1
End Sub][/code]
and the code for the save button is
[Private Sub btnCommit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
If inc <> -1 Then
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Login").NewRow()
dsNewRow.Item("Username") = txtUsername.Text
dsNewRow.Item("Password") = txtPassword.Text
ds.Tables("Login").Rows.Add(dsNewRow)
da.Update(ds, "Login")
End If
End Sub
][/code]

New Topic/Question
Reply



MultiQuote




|