It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Help Access connection, textbox error

Moderator: dafunkymunky

Help Access connection, textbox error

Postby valgris on Sat Oct 17, 2009 6:29 pm

Okay so i have a text box that should show the last entered record when i click a button, i have got it to get the correct record however i am getting an error the record is an autonumber called customerid, the text box only shows the last digit of the auto number the autonumbers go up like this

0001
0002
0003
etc
(thats how theyre formated in access)
but the text box only shows 3 instead of 0003
i tried changing the format to 1000 so it went up like this
1001
1002
1003
still the text box only showed 3, what is going wrong?, thanks in advance

here is my code


Code: Select all
        provider4 = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" 'database provider established
        dbcustomer = "data Source = ..\..\Booking.mdb"
        customerconnection.ConnectionString = provider4 & dbcustomer 'connect the database and the database provider
        Bookingconnection.Open()
        SqlQuery4 = "SELECT * FROM  Customer WHERE CustomerID = (SELECT MAX(CustomerID) FROM Customer) "
        dacustomer = New OleDb.OleDbDataAdapter(SqlQuery4, customerconnection) 'and puts the info into database provider
        dacustomer.Fill(dscustomer, "Customer") 'puts the copied information into the dataset
        Bookingconnection.Close()
        NumberofRows4 = dscustomer.Tables("Customer").Rows.Count
        TxtCID.Text = dscustomer.Tables("Customer").Rows(NumberRow4).Item(0)
valgris
 
Posts: 1
Joined: Sat Oct 17, 2009 6:24 pm

Who is online

Users browsing this forum: No registered users and 4 guests