:confused: I am doing a project and i need to be able to add, record, search and delete customer bookings. I am using VB.Net 2003 and microsoft access 2003 and i need help on how to do this. Can anybody help me?? PLEASE?!?!

Basically i need the information that is entered in VB.Net to be stored in an access database e.g. name, tel no, date, time, table no, etc and search for the customer as well. i hope that makes sense.:confused:

Dani AI

Generated

Short version: do not use DAO.DBEngine in VB.Net 2003 — that approach is from VB6. Use ADO.NET with the OLE DB provider to talk to an Access .mdb. Create a simple Access table with an AutoNumber primary key (e.g., BookingID) and safe column names (avoid spaces and reserved words like Date or Time; use BookingDate, BookingTime, PeopleCount, DepositPaid). Use parameterized commands (OleDb uses positional ? parameters) for INSERT / UPDATE / DELETE and always update/delete by the primary key.

Minimal VB.NET 2003 pattern (ADO.NET + Jet):

Imports System.Data.OleDb

Dim connStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Path\Bookings.mdb;"
Using cn As New OleDbConnection(connStr)
    cn.Open()

    ' INSERT example (parameters must be added in the same order as the ? placeholders)
    Dim insertCmd As New OleDbCommand("INSERT INTO Bookings (Name, TelNo, BookingDate, BookingTime, PeopleCount, DepositPaid, TableNo) VALUES (?, ?, ?, ?, ?, ?, ?)", cn)
    insertCmd.Parameters.Add(New OleDbParameter("Name", OleDbType.VarChar)).Value = TxtName.Text
    insertCmd.Parameters.Add(New OleDbParameter("TelNo", OleDbType.VarChar)).Value = TxtTel.Text
    insertCmd.Parameters.Add(New OleDbParameter("BookingDate", OleDbType.Date)).Value = DateTime.Parse(TxtDate.Text)
    insertCmd.Parameters.Add(New OleDbParameter("BookingTime", OleDbType.VarChar)).Value = TxtTime.Text
    insertCmd.Parameters.Add(New OleDbParameter("PeopleCount", OleDbType.Integer)).Value = CInt(TxtPeople.Text)
    insertCmd.Parameters.Add(New OleDbParameter("DepositPaid", OleDbType.Boolean)).Value = chkDeposit.Checked
    insertCmd.Parameters.Add(New OleDbParameter("TableNo", OleDbType.Integer)).Value = CInt(TxtTableNo.Text)
    insertCmd.ExecuteNonQuery()
End Using

Troubleshooting and notes: rename problematic fields (spaces and punctuation break SQL and parameter binding); test SQL in Access first; use WHERE BookingID = ? for UPDATE/DELETE; parameter order matters for OleDb; wrap Date values or use parameterized dates (avoid string-formatted dates); protect the .mdb path (use Application.StartupPath or a config setting) and be aware Jet 4.0 is 32-bit only (on modern 64-bit machines you may need the ACE provider). and pointed to tutorials that help with the UI and flow; was right to ask for effort — the above shows the correct ADO.NET pattern to apply. For API details see OleDbConnection and OleDbCommand and OleDbDataAdapter.

Recommended Answers

All 6 Replies

show the effort and many people will help you :)

hi. sorry. erm iv got this so far (if it makes any sens) but i think it is totally wrong and i really duno where to go from here. iv tried a million books and got no help from them!!

Dim dbE As New DAO.DBEngine
Dim db As DAO.Database
Dim rs As DAO.Recordset

db = dbE.OpenDatabase(Trim(TextBox1.Text))

rs = db.OpenRecordset("UPDATE Bookings (Name, TelNo, Date, Time, How many people?, Deposit paid?, TableNo) VALUE ("")" + Trim(Txtname.Text) + "'")

Try
If (rs.Fields("Name").Value) = Trim(Txtname.Text) Then

Dim Name, TelNo, Date1, Time, Howmanypeople, Depositpaid, TableNo As String
Name = rs.Fields("Name").Value
TelNo = rs.Fields("TelNo").Value
Date1 = rs.Fields("Date").Value
Time = rs.Fields("Time").Value
Howmanypeople = rs.Fields("How many people?").Value
Depositpaid = rs.Fields("Deposit paid?").Value
TableNo = rs.Fields("TableNo").Value
End If
End Try

Someone asked a similar question recently and

Someone asked a similar question recently and

Thanks for that but I am doing my project in 2003. I watched it and tried but I am still lost! I forgot to mention that I am new to this as well!

Hi
I had the same problem as you a few months ago. Try the webiste www.homeandlearn.co.uk
this goes through what yo need to do step by step

Hi
I had the same problem as you a few months ago. Try the webiste www.homeandlearn.co.uk
this goes through what yo need to do step by step

Thanks. I'll take a look.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.