Hi guys,
I'm getting this weird error when populating a listview.
Data Provider or other service returned an E_FAIL status
But before that I'm getting a runtime error "Invalid Use of Null". I fixed it by concatenating vbNullString then now I'm getting that weird error.
Information Below:
Frontent: Visual Basic 6 SP6
Backend: SQL SERVER 2005
Connection Settings on Module:
Code where the error occurs:Code:Public Sub Open_Connection() Set con = New ADODB.Connection With con .ConnectionString = "Provider=SQLNCLI;Server=xx.xxx.xxx.xx\instance;Database=dbase;Uid=username; Pwd=password;" .CommandTimeout = 0 .CursorLocation = adUseClient .Open End With End Sub
The offending line is rs.MoveNextCode:rs.Open "sp_storedprocedure '" & Format(DTPicker1.Value, "YYYY-MM-DD") & " 00:00:00.000" & "', '" & Format(DTPicker2.Value, "YYYY-MM-DD") & " 23:59:59.000" & "', '" & CustID & "'", con, 3, 1 Do Until rs.EOF With ListView .ListItems.Add , , "" .ListItems(lngCounter).ListSubItems.Add.Text = rs.Fields("Name").Value & vbNullString .ListItems(lngCounter).ListSubItems.Add.Text = rs.Fields("CharacterCount").Value & vbNullString TNL = TNL + CDbl(rs.Fields("CharacterCount").Value) .ListItems(lngCounter).ListSubItems.Add.Text = rs.Fields("AuthorName").Value & vbNullString .ListItems(lngCounter).ListSubItems.Add.Text = rs.Fields("ReportType").Value & vbNullString TNP = TNP + CLng(rs.Fields("PageCount").Value) TD = TD + CDbl(rs.Fields("Duration").Value) End With lngCounter = lngCounter + 1 rs.MoveNext Loop
I hope you can help me guys I'm stumped with this kind of error.
-zynder




Reply With Quote