I am working to create a page(s) where the user can enter in the record they are looking for, and then the next page will show the results based on the user entered information. The first page is a standard search page, just asking the user to enter their query info in. The second page contains a component that I have created to actually retrieve the data and then return it to the ASP page, where it is then formatted, etc.
I have discovered that the page works fine for some records, but not all. The problem appears to have to do with the data. For about half the records, the record may read: 123456
However, for the remaining, the record may read: 000123 or even 123456A000. These records are not working. Instead, I get an error message that essentially says it cannot create the recordset. I think it has to do with the way the records are being passed from the ASP page, but not really certain. Has anyone run into this before? Attached is some of the pertinent code. Thanks!
ASP Page:
<%
dim objPOInfo, rs, RequestValue
set objPOInfo = server.CreateObject("PropInfoTest.clsGetPropertyInfo"
set rs = objPOInfo.GetPropertyInfo(Request.Form("txtPropID"
)
Response.Write "This is the value of " & Request.Form("txtPropID"
& "."
Response.Write " "
Response.Write rs.recordcount & "<BR>"
Response.Write rs("Lease_ID"
& "<BR>"
Response.Write rs("Occupant"
& "<BR>"
set rs=nothing
set objPOInfo=nothing
%>
VB component:
Public Function GetPropertyInfo(strPropID As Variant) As ADODB.Recordset
'Public Function GetPropertyInfo() As ADODB.Recordset
Dim objContext As COMSVCSLib.ObjectContext
Dim rsPropInfo As ADODB.Recordset
On Error GoTo Error_Handler
Set objContext = GetObjectContext()
Set rsPropInfo = New ADODB.Recordset
With rsPropInfo
.CursorLocation = adUseClient
.LockType = adLockReadOnly
.CursorType = adOpenForwardOnly
.Source = "SELECT * FROM L_Location_Info WHERE Lease_ID = " & strPropID
.ActiveConnection = "Driver={SQL Server};Server=(servername);Database=DBName;uid=***;password=***"
.Open
'Disconnect the recordset now that it's open.
Set .ActiveConnection = Nothing
End With
Set GetPropertyInfo = rsPropInfo
If Not objContext Is Nothing Then objContext.SetComplete
Exit_Handler:
Set objContext = Nothing
Exit Function
Error_Handler:
If Not objContext Is Nothing Then objContext.SetAbort
Resume Exit_Handler
End Function
Give me liberty, or give me pizza...
I have discovered that the page works fine for some records, but not all. The problem appears to have to do with the data. For about half the records, the record may read: 123456
However, for the remaining, the record may read: 000123 or even 123456A000. These records are not working. Instead, I get an error message that essentially says it cannot create the recordset. I think it has to do with the way the records are being passed from the ASP page, but not really certain. Has anyone run into this before? Attached is some of the pertinent code. Thanks!
ASP Page:
<%
dim objPOInfo, rs, RequestValue
set objPOInfo = server.CreateObject("PropInfoTest.clsGetPropertyInfo"
set rs = objPOInfo.GetPropertyInfo(Request.Form("txtPropID"
Response.Write "This is the value of " & Request.Form("txtPropID"
Response.Write " "
Response.Write rs.recordcount & "<BR>"
Response.Write rs("Lease_ID"
Response.Write rs("Occupant"
set rs=nothing
set objPOInfo=nothing
%>
VB component:
Public Function GetPropertyInfo(strPropID As Variant) As ADODB.Recordset
'Public Function GetPropertyInfo() As ADODB.Recordset
Dim objContext As COMSVCSLib.ObjectContext
Dim rsPropInfo As ADODB.Recordset
On Error GoTo Error_Handler
Set objContext = GetObjectContext()
Set rsPropInfo = New ADODB.Recordset
With rsPropInfo
.CursorLocation = adUseClient
.LockType = adLockReadOnly
.CursorType = adOpenForwardOnly
.Source = "SELECT * FROM L_Location_Info WHERE Lease_ID = " & strPropID
.ActiveConnection = "Driver={SQL Server};Server=(servername);Database=DBName;uid=***;password=***"
.Open
'Disconnect the recordset now that it's open.
Set .ActiveConnection = Nothing
End With
Set GetPropertyInfo = rsPropInfo
If Not objContext Is Nothing Then objContext.SetComplete
Exit_Handler:
Set objContext = Nothing
Exit Function
Error_Handler:
If Not objContext Is Nothing Then objContext.SetAbort
Resume Exit_Handler
End Function
Give me liberty, or give me pizza...