PDA

Click to See Complete Forum and Search --> : OleDb FoxPro Problems!


ChrisWise
Dec 4th, 2002, 05:00 AM
Hi,

I was using the code below to pull up records from an access database which worked fine, but I now want to do the same to a foxpro 7 database.

It connects to the foxpro dbase but after stepping through the code I found it crashes at

"dgPrevious.DataSource = cmdSelect.ExecuteReader"

the error is "Object reference not set to an instance of an object."



Dim con As OleDb.OleDbConnection
Dim cmdSelect As OleDb.OleDbCommand


Call OpenConnection() ' Own procedure

sqlquery = "SELECT Datereq, NetLogin, Title, Status, RequestId FROM " & tbname

cmdSelect = New OleDb.OleDbCommand(sqlquery, con)


dgPrevious.DataSource = cmdSelect.ExecuteReader


dgPrevious.DataBind()


Thanks

Chris

J Staniforth
Dec 5th, 2002, 03:41 AM
By experience I find that if there is a problem with db connection it fails after code for connection but when you apply it.
Can you post the code for Call OpenConnection() ?
I suspect there is a problem here (perhaps).