Dec 2, 2005 #1 VICKEL1 Programmer Joined May 16, 2005 Messages 15 Location 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?
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?
Dec 2, 2005 #2 chrissie1 Programmer Joined Aug 12, 2002 Messages 4,517 Location BE yep plenty but the errormessage you get? Christiaan Baes Belgium I just like this --> [Wiggle] [Wiggle] Upvote 0 Downvote
yep plenty but the errormessage you get? Christiaan Baes Belgium I just like this --> [Wiggle] [Wiggle]
Dec 2, 2005 #3 ca8msm Programmer Joined May 9, 2002 Messages 11,327 Location GB 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. Upvote 0 Downvote
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.
Dec 2, 2005 Thread starter #4 VICKEL1 Programmer Joined May 16, 2005 Messages 15 Location GB 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. Upvote 0 Downvote
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.
Dec 2, 2005 #5 chrissie1 Programmer Joined Aug 12, 2002 Messages 4,517 Location BE rs is what? Christiaan Baes Belgium I just like this --> [Wiggle] [Wiggle] Upvote 0 Downvote
Dec 2, 2005 #6 ca8msm Programmer Joined May 9, 2002 Messages 11,327 Location GB Item cannot be found in the collection corresponding to the requested name or ordinal Click to expand... 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. Upvote 0 Downvote
Item cannot be found in the collection corresponding to the requested name or ordinal Click to expand... 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.
Dec 2, 2005 Thread starter #7 VICKEL1 Programmer Joined May 16, 2005 Messages 15 Location GB 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 Upvote 0 Downvote
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
Dec 2, 2005 #8 chrissie1 Programmer Joined Aug 12, 2002 Messages 4,517 Location BE this is the vb.net forum you know. and ado is replaced with ado.net. Christiaan Baes Belgium I just like this --> [Wiggle] [Wiggle] Upvote 0 Downvote
this is the vb.net forum you know. and ado is replaced with ado.net. Christiaan Baes Belgium I just like this --> [Wiggle] [Wiggle]