Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

The error that I am getting is: Value cannot be null. This is using an Access DB

 

My connection works fine.

 

Here is the code

Public Function GetPersonnel() as Dataview

Dim dv as DataView

Dim da as Oledbdataadapter

Dim ds as dataset

Dim strSQL as as string = "SELECT tblPersonel.KeyPersonel AS Key, " & _

"tblPersonel.LastName & ', ' & tblPersonel.FirstName AS Contact " & _

"FROM tblPersonel

Dim cn OledbConnection

cn = Me.ConnectLogIn

da = New OledbDataadapter(strSQL, cn)

da.Fill(ds) <-------------------This is the line throwing the error

 

Any ideas?

 

Thanks, Chester

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

  • Moderators
Posted

Are these typos or this is the way your code looks, if the latter I'm surprised it even compiles...

 

it should be (and by the way, you don't need to prefix with the table name when there's only a single table in your query)

 

Also, 'key' is a keyword in SQL server, I'm not sure about Access

 

Dim strSQL as as string ="SELECT KeyPersonel AS myKey, (LastName & ', ' & FirstName) AS Contact FROM tblPersonel "

Visit...Bassic Software
Posted

Thanks, for the help... I had to change a couple of other things to make it work. I usually prefix with a table to make my code easier to follow.

 

Chester

____________________________________________

http://www.pophamcafe.com

I am starting a developers section, more tutorials than anything.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...