S
Sparky Arbuckle
Hello all! I am trying to get information from a HashTable to display
in a DataList using a SQL statement. Is this possible? When the visitor
'adds item to cart' they are redirected to
ShoppingCart.aspx?add=ITEMID. The HashTable simply stores The ITEMID,
Quantity, and an option for ADD / REMOVE.
I have a database table, tblItemInfo, that has the description,
prices, images, etc... of each individual ITEMID. How would I go about
correllating the Data List and displaying the information from the
HashTable?
If you need code samples please let me know and I will supply more. For
now:
<!----- THIS IS AS FAR AS I'VE GOTTEN ----->
IF htCart.Count = 0 THEN
lblMessage.text = "<tr><td align='center' colspan='3'>Cart is
empty</td></tr>"
ELSE
FOR EACH myItem as DictionaryEntry in htCart
Dim objConn as new
OLEDBConnection(ConfigurationSettings.AppSettings("StrConnection"))
Dim strSQL as string = "SELECT ITEMID, PRICE, Description, ImageDir
FROM tblItemInfo WHERE ITEMID = '" & myItem.key & "';"
Dim objDataReader as OLEDBDataReader
objConn.Open()
Dim objCommand as new OLEDBCommand(strSQL,objConn)
Music.DataSource =
objCommand.ExecuteReader(CommandBehavior.CloseConnection)
dlINFO.DataBind()
dlINFO.RepeatColumns = 1
lblMessage.text += _
"<table>" & _
"<tr>" & _
"<td>" & myItem.Key & "</td>" & _
"<td>" & myItem.Value & "</td>" & _
"<td><a href='?Delete=" & myItem.Key & "'>Remove</a>" &
_
"<a href='?Add=" & myItem.Key & "'>Add </a></td>" &
_
"</tr>" & _
"</table>"
NEXT
END IF
<!----- THIS IS AS FAR AS I'VE GOTTEN ----->
in a DataList using a SQL statement. Is this possible? When the visitor
'adds item to cart' they are redirected to
ShoppingCart.aspx?add=ITEMID. The HashTable simply stores The ITEMID,
Quantity, and an option for ADD / REMOVE.
I have a database table, tblItemInfo, that has the description,
prices, images, etc... of each individual ITEMID. How would I go about
correllating the Data List and displaying the information from the
HashTable?
If you need code samples please let me know and I will supply more. For
now:
<!----- THIS IS AS FAR AS I'VE GOTTEN ----->
IF htCart.Count = 0 THEN
lblMessage.text = "<tr><td align='center' colspan='3'>Cart is
empty</td></tr>"
ELSE
FOR EACH myItem as DictionaryEntry in htCart
Dim objConn as new
OLEDBConnection(ConfigurationSettings.AppSettings("StrConnection"))
Dim strSQL as string = "SELECT ITEMID, PRICE, Description, ImageDir
FROM tblItemInfo WHERE ITEMID = '" & myItem.key & "';"
Dim objDataReader as OLEDBDataReader
objConn.Open()
Dim objCommand as new OLEDBCommand(strSQL,objConn)
Music.DataSource =
objCommand.ExecuteReader(CommandBehavior.CloseConnection)
dlINFO.DataBind()
dlINFO.RepeatColumns = 1
lblMessage.text += _
"<table>" & _
"<tr>" & _
"<td>" & myItem.Key & "</td>" & _
"<td>" & myItem.Value & "</td>" & _
"<td><a href='?Delete=" & myItem.Key & "'>Remove</a>" &
_
"<a href='?Add=" & myItem.Key & "'>Add </a></td>" &
_
"</tr>" & _
"</table>"
NEXT
END IF
<!----- THIS IS AS FAR AS I'VE GOTTEN ----->