Guest_imported
New member
- Jan 1, 1970
- 0
Hi,
Ive got the following code in (A) below which Ive copied from a textbook which works but when I move the vairable declaration 'Dim rsItem' from in-line to the top as in (B) it doesnt work. Why ?
(A)
<%
Dim blnNew
' detect whether the user is adding a new item or editing an existing one
Select Case Request.QueryString("Action"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Case "AddNew"
blnNew = True
Case "Edit"
blnNew = False
End Select
If blnNew Then
Response.Write _
"<CENTER><H1>Wrox Classifieds<BR>Add New Sale Item</H1></CENTER>" & _
"<P>Please add the following information for the item you have for sale. "
Else
Response.Write _
"<CENTER><H1>Wrox Classifieds<BR>Edit Sale Item</H1></CENTER>" & _
"<P>Please edit the information for this item currently for sale. "
Dim rsItem
Set rsItem = Server.CreateObject("ADODB.Recordset"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strSQL = "SELECT * FROM Item WHERE ItemID = " & Request("Item"
& ";"
rsItem.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
End If
%>
(B)
<%
Dim blnNew
Dim rsItem
' detect whether the user is adding a new item or editing an existing one
Select Case Request.QueryString("Action"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
Case "AddNew"
blnNew = True
Case "Edit"
blnNew = False
End Select
If blnNew Then
Response.Write _
"<CENTER><H1>Wrox Classifieds<BR>Add New Sale Item</H1></CENTER>" & _
"<P>Please add the following information for the item you have for sale. "
Else
Response.Write _
"<CENTER><H1>Wrox Classifieds<BR>Edit Sale Item</H1></CENTER>" & _
"<P>Please edit the information for this item currently for sale. "
Set rsItem = Server.CreateObject("ADODB.Recordset"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
strSQL = "SELECT * FROM Item WHERE ItemID = " & Request("Item"
& ";"
rsItem.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
End If
%>
Ive got the following code in (A) below which Ive copied from a textbook which works but when I move the vairable declaration 'Dim rsItem' from in-line to the top as in (B) it doesnt work. Why ?
(A)
<%
Dim blnNew
' detect whether the user is adding a new item or editing an existing one
Select Case Request.QueryString("Action"
Case "AddNew"
blnNew = True
Case "Edit"
blnNew = False
End Select
If blnNew Then
Response.Write _
"<CENTER><H1>Wrox Classifieds<BR>Add New Sale Item</H1></CENTER>" & _
"<P>Please add the following information for the item you have for sale. "
Else
Response.Write _
"<CENTER><H1>Wrox Classifieds<BR>Edit Sale Item</H1></CENTER>" & _
"<P>Please edit the information for this item currently for sale. "
Dim rsItem
Set rsItem = Server.CreateObject("ADODB.Recordset"
strSQL = "SELECT * FROM Item WHERE ItemID = " & Request("Item"
rsItem.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
End If
%>
(B)
<%
Dim blnNew
Dim rsItem
' detect whether the user is adding a new item or editing an existing one
Select Case Request.QueryString("Action"
Case "AddNew"
blnNew = True
Case "Edit"
blnNew = False
End Select
If blnNew Then
Response.Write _
"<CENTER><H1>Wrox Classifieds<BR>Add New Sale Item</H1></CENTER>" & _
"<P>Please add the following information for the item you have for sale. "
Else
Response.Write _
"<CENTER><H1>Wrox Classifieds<BR>Edit Sale Item</H1></CENTER>" & _
"<P>Please edit the information for this item currently for sale. "
Set rsItem = Server.CreateObject("ADODB.Recordset"
strSQL = "SELECT * FROM Item WHERE ItemID = " & Request("Item"
rsItem.Open strSQL, objConn, adOpenForwardOnly, adLockOptimistic, adCmdText
End If
%>