Advertisement

04.18.2008 at 11:35AM PDT, ID: 23335170
[x]
Attachment Details

oledb datareader, retrieve autonumber on vb.net 2005 winform

Asked by systems_ax in Visual Studio .NET 2005, Visual Basic Programming, Microsoft Visual Basic.Net

I am developing with visual basic 2005 and access 2007.
I need to be able to retrieve an auto number on my form.  This is a function that currently retrieves all the necessary records.  As soon as I include A ClientId, which is an autonumber in access, the code breaks:

"Index out of range exception was unhandled".  
Had anyone tried such a procedure and was successfull?
thank youStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
Private Sub RetrievClientsDetails()
        Dim conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb")
        Dim command As New OleDbCommand("select * from ((((tblClients left outer JOIN tblClientOne ON (tblClients.ClientId = tblClientOne.ClientId)) left outer JOIN tblClientTwo on (tblClients.ClientId=tblClientTwo.ClientId)) left outer JOIN tblClientThree on (tblClients.ClientId=tblClientThree.ClientId)) left outer JOIN tblClientFour on (tblClients.ClientId=tblClientFour.ClientId)) where tblClients.ClientId=" & _clientID, conn)
        conn.Open()
        Dim contactreader As OleDbDataReader = command.ExecuteReader
        contactreader.Read()
 
  	  'Me.txtClientTrueId.Text = contactreader("ClientId").ToString
 
        Me.txtLast.Text = contactreader("ClientLastName").ToString
        Me.txtFirst.Text = contactreader("ClientFirstName").ToString
        Me.txtMiddle.Text = contactreader("ClientMiddleName").ToString
        Me.txtCompany.Text = contactreader("ClientCompany").ToString
        Me.txtAddress1.Text = contactreader("ClientStreetAddress1").ToString
        Me.txtAddress2.Text = contactreader("ClientStreetAddress2").ToString
        Me.txtID.Text = contactreader("ClientIdentificationNumber").ToString
        Me.txtCity.Text = contactreader("ClientCity").ToString
        Me.txtState.Text = contactreader("ClientState").ToString
        Me.txtPostal.Text = contactreader("ClientPostalCode").ToString
        Me.txtCountry.Text = contactreader("ClientCountry").ToString
        Me.txtDate.Text = contactreader("ClientDateofBirth").ToString
        Me.txtPhone1.Text = contactreader("ClientTelephoneNumberOne").ToString
        Me.txtPhone2.Text = contactreader("ClientTelephoneNumberTwo").ToString
        Me.txtFax.Text = contactreader("ClientFaxNumber").ToString
        Me.txtEmail.Text = contactreader("ClientEmail").ToString
        conn.Close()
          End Sub
 
 
[+][-]04.18.2008 at 12:05PM PDT, ID: 21388722

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.18.2008 at 01:24PM PDT, ID: 21389334

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.18.2008 at 05:57PM PDT, ID: 21390589

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.18.2008 at 05:59PM PDT, ID: 21390602

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio .NET 2005, Visual Basic Programming, Microsoft Visual Basic.Net
Sign Up Now!
Solution Provided By: JackOfPH
Participating Experts: 3
Solution Grade: A
 
 
[+][-]04.19.2008 at 12:11AM PDT, ID: 21391477

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.19.2008 at 01:54PM PDT, ID: 21393877

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.21.2008 at 07:50AM PDT, ID: 21402429

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628