Click to See Complete Forum and Search --> : 2 questions, Pls help


ChrisWise
December 4th, 2002, 09:20 AM
Hi,

1)

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()




2) I have two listboxs, one is populated from a database the other is populated by the item selected in the first, my problem is that when an item from listbox1 is selected the page refreshs and it doesnt retain the item selected.

A) Autopostback is enabled one listbox1 (not listbox2)
B) Both have viewstate enabled



Thanks

Chris