macgyver
May 31st, 2006, 04:30 PM
Hi,
I am currently trying to convert a bunch of code from ASP to ASPx. I was hoping to simply move the code into the new system without major modifications, but with no luck.
Anyway, I am wondering how to change the following code into the new ASPx format with the smallest amount of recoding. Any help would be great, as I have a lot of code that this will need to be done with.
My biggest holdup right now is how to DIM rst in the code, or is this even the correct approach?
This code worked with ASP 1.1, but not 2.0.
Session("ecab_customer") = ""
Session("ecab_name") = ""
Session("ecab_zip_code") = ""
strQuery="SELECT ""ecab_customer""=customer_id, ""ecab_name""=customer_name, ""ecab_zip_code""=zip_code FROM [SOFCM] WHERE CUSTOMER_ID='" & cstID &"' AND ZIP_CODE='" & cstZIP &"'"
strProvider="driver={SQL Server}; server=myServer; database=Mydb; UID=username; PWD=password; "
set rst=server.CreateObject("ADODB.recordset")
rst.Open strQuery, strProvider
If (Not rst.EOF) Then
For Each fld in rst.Fields
If fld.Value="" Then
Response.Redirect "https://invalid.asp"
Else
Session(fld.Name) = RTrim(fld.Value)
End If
Next
rst.MoveNext
End If
Any help witht his conversion will save me a great amount of work. If you need me to post additional information, please ask.
thanks.
I am currently trying to convert a bunch of code from ASP to ASPx. I was hoping to simply move the code into the new system without major modifications, but with no luck.
Anyway, I am wondering how to change the following code into the new ASPx format with the smallest amount of recoding. Any help would be great, as I have a lot of code that this will need to be done with.
My biggest holdup right now is how to DIM rst in the code, or is this even the correct approach?
This code worked with ASP 1.1, but not 2.0.
Session("ecab_customer") = ""
Session("ecab_name") = ""
Session("ecab_zip_code") = ""
strQuery="SELECT ""ecab_customer""=customer_id, ""ecab_name""=customer_name, ""ecab_zip_code""=zip_code FROM [SOFCM] WHERE CUSTOMER_ID='" & cstID &"' AND ZIP_CODE='" & cstZIP &"'"
strProvider="driver={SQL Server}; server=myServer; database=Mydb; UID=username; PWD=password; "
set rst=server.CreateObject("ADODB.recordset")
rst.Open strQuery, strProvider
If (Not rst.EOF) Then
For Each fld in rst.Fields
If fld.Value="" Then
Response.Redirect "https://invalid.asp"
Else
Session(fld.Name) = RTrim(fld.Value)
End If
Next
rst.MoveNext
End If
Any help witht his conversion will save me a great amount of work. If you need me to post additional information, please ask.
thanks.