|
-
Feb 14th, 2006, 11:00 AM
#1
Thread Starter
Lively Member
Error: Object reference not set to an instance of an object
Hi All,
Anyone know why is is failing with the error "Object reference not set to an instance of an object"?
I know it's failing at the line indicated...
VB Code:
sSql = "Select CUSTOMERCODE, CUSTOMERNAME, CUSTOMERADD1, CUSTOMERADD2, CUSTOMERADD3, CUSTOMERADD4, CUSTOMERPOSTCODE, CUSTOMERPRICECODE from PU_CUSTOMERDETAILS"
rsCustomerData.Open(sSql, m_dbconn, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, -1)
'Loop through all customer records
If rsCustomerData.EOF = False Then
rsCustomerData.MoveFirst()
'Set up the progressbar...
lProgressBarCount = 0
MainForm.ProgressBar1.Minimum = 1
'Error on this line (with the rsCustomerData.RecordCount bit)
MainForm.ProgressBar1.Maximum = rsCustomerData.RecordCount
'...blah blah blah
By the way, this code runs fine in the Dev environment but not when compiled and installed on the client machine.
My Spidey senses are tingling!
-
Feb 14th, 2006, 12:01 PM
#2
Re: Error: Object reference not set to an instance of an object
is it rsCustomerData that's giving you the error?
If so, make sure you include "New" somewhere. The object needs to be instantiated to work.
Also, in .Net you might want to look into ADO.Net instead of legacy ADO. There's a good tutorial in techgnome's signature. Should be able to explain all you need. There's also numerous threads on VBF made about ADO.Net.
-
Feb 14th, 2006, 12:07 PM
#3
Fanatic Member
Re: Error: Object reference not set to an instance of an object
i guess you didn't set
[Highlight=VB]rsCustomerData = new recordset [/vbcod]
but it's not .net and im not familir, but it would be my bet. as 7halo said, you should check .net object like dataset and datatable and dataadapter and dataview and datarelation and datarow and dataALLtheWAY...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|