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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing variables

Status
Not open for further replies.

Chopstik

Technical User
Oct 24, 2001
2,180
US
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(&quot;PropInfoTest.clsGetPropertyInfo&quot;)
set rs = objPOInfo.GetPropertyInfo(Request.Form(&quot;txtPropID&quot;))

Response.Write &quot;This is the value of &quot; & Request.Form(&quot;txtPropID&quot;) & &quot;.&quot;
Response.Write &quot;  &quot;
Response.Write rs.recordcount & &quot;<BR>&quot;
Response.Write rs(&quot;Lease_ID&quot;) & &quot;<BR>&quot;
Response.Write rs(&quot;Occupant&quot;) & &quot;<BR>&quot;

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 = &quot;SELECT * FROM L_Location_Info WHERE Lease_ID = &quot; & strPropID
.ActiveConnection = &quot;Driver={SQL Server};Server=(servername);Database=DBName;uid=***;password=***&quot;
.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...
 
Umm... why the VB component? It's just as easy to do it straight from ASP.
I haven't actually experienced this exact problem before, but I have had trouble in the past with passing recordset objects to/from ASP functions. My experiences led to no good results, however. I would suggest doing this from your ASP page, despite the fact that you probably have a good reason to write a component (security or somesuch).
-Tarwn
 
The VB component was a business requirement from management... Not my first choice as I had already done something like this in ASP. However, I did find the answer was that I had not put a single quotes around the variable in my SELECT statement in the component. Thanks! Give me liberty, or give me pizza...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top