cpopham Posted June 17, 2004 Posted June 17, 2004 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 Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
Moderators Robby Posted June 17, 2004 Moderators Posted June 17, 2004 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 " Quote Visit...Bassic Software
cpopham Posted June 17, 2004 Author Posted June 17, 2004 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 Quote ____________________________________________ http://www.pophamcafe.com I am starting a developers section, more tutorials than anything.
pelikan Posted June 18, 2004 Posted June 18, 2004 Also note - ds is uninitialized ie Null object reference. Quote IN PARVUM MULTUM
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.