I am presently working on an application for a fictive taxi company, and I have to record each new customer with a customerID set as AutoNumber with a specific format:
Field size : Long integer
New Values : Increment
Format : \C00
Indexed : Yes(No Duplicate)
Text Align : General
Below is an example of how it appears in the database:
IdClient Nom Prenom Adresse TelNo
C002 Smith Jackson Port-Louis 03546649
My VB.NET Form linked to my database does not show the same format, for instance, on the example above, in the 'IdClient' field it would show '2', completely ignoring the format for the field.
I use this connection "Provider=Microsoft.ACE.OLEDB.12.0;"
Public DBDA As OleDbDataAdapter
Public DBDT As DataTable
DBDT = New DataTable
DBDA = New OleDbDataAdapter(DBCmd)
RecordCount = DBDA.Fill(DBDT)
and to pull the data to my datagridView
DgvClient.DataSource = Access.DBDT
I tried to look for a solution and found https://social.msdn.microsoft.com/Forums/vstudio/en-US/bad5f735-438b-4203-983f-a9e2ba06cb96/inserting-records-into-ms-access-where-there-is-an-autonumber-for-a-primary-key?forum=vbgeneral but it doesn't seem to fix my issues. Do I have to append the format to each data pulled from the 'IdClient' Column before it shows in the datagridview? Is there a way to keep the format when pulling the data from MS Access?