write and retrieve data from ACCESS mdb

lhogan

New member
Joined
Jun 4, 2008
Messages
1
Programming Experience
Beginner
I am trying to write a simple timeshee program where employees clock in and out. they just enter their name and click the "clockin" or "clockout" button.

I have my form; I have my ACCESS database. But I can't figure out how to write to the ACCESS table. All I want to do is write rows to the ACCESS table. There are no bound controls or grids on the form.

Can anyone give me a simple tutorial that just shows me (in the simplest fashion) how to write data into the table?
Thanks
Larry
 
U could simply do a insert sql command using System.Data.OleDb


when the user clicks on clock in or clock out whichever it may be

VB.NET:
        Dim sqlConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="database.mdb")
        Dim sqlCommand As New OleDbCommand
        Dim insertSQL As String = "INSERT INTO table_name (column1, column2,..., ColumnN") _
VALUES("value1, value2, ..., valueN")" 'insert ur values here with ur time and name
        sqlCommand = New OleDbCommand(insertSQL, sqlConn)
                Try
                    sqlCommand.ExecuteNonQuery()
                Catch ex As Exception
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                End Try
 
Back
Top