VB6, ADO, MSDataGrid and Data Environment
Posted on 1998-12-24
I used VB6, ADO and Data environment and I've the following codes in my program:
Set grdMain.DataSource = envApplication
grdMain.DataMember = "comCustomerList"
where env = Data Environment
grd = MS Data Grid ver 6
com = Data Env Command objects
IT works fine and correctly populates my datagrid with the relevant list of records from the customer table. Now I'd like to have a REFRESH button that requeries the underlying recordset and updates the datagrid.
My code looks like this:
envApplication.rscomCustomerList.close 'closes the recordset
envApplication.comCustomerList 'reopens it
grdMain.DataMember = "comCustomerList" rebind to datagrid
Many people I asked had told me this code should work. My problem is that the program crashes at the last line (grdMain.DataMember = "comCustomerList") with fatal error on MSDATGRD.OCX or sometimes MSADO15.DLL
An alternative code will be:
In this case, it'll crash right away!! Someone even send me his working program using the same codes, but I still get the same errors running it on my PC. Which brings me to suspect that the problem may not be in the "codes" but is in the system files (OCXs or DLLs) in my computer's configuration, or even a bug in the DataGrid itself. Has anyone faced similar problems?
Thanks and Merry Christmas.