Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dbisnull

Status
Not open for further replies.

VICKEL1

Programmer
May 16, 2005
15
GB
I am receiveing an error on this line of my code,

If Not IsDBNull(CStr(rs.Fields("a_date").Value)) Then
.Items(i).SubItems.Add(CStr(rs.Fields("a_date").Value))

End If

Any ideas?















 
yep plenty but

the errormessage you get?


Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
If you're not in a With block then the following won't work:
Code:
 .Items(i).SubItems.Add(CStr(rs.Fields("a_date").Value)
but as Chrissie said, you haven't supplied any information so that's about as helpful as we can be.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
It is in a with block and the error message is:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in adodb.dll

Additional information: Item cannot be found in the collection corresponding to the requested name or ordinal.
 
rs is what?

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Item cannot be found in the collection corresponding to the requested name or ordinal
Looks like it can't find the item that you are referring to. Make sure it exists and that you have typed it in correctly.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Dim cmdText As String
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i As Integer
Dim strTest As String

con.Open("Driver={SQL Server};Server=..........")

cmdText = "Select * from ........."
rs.Open(cmdText, con)
i = 0

While Not rs.EOF
With Me.LstViewLease

If Not IsDBNull(CStr(rs.Fields("a_date").Value)) Then
.Items(i).SubItems.Add(CStr(rs.Fields("a_date").Value))

End If

End With
rs.MoveNext()
i = i + 1
End While



End Sub
 
this is the vb.net forum you know. and ado is replaced with ado.net.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top