不行的,起初是....sql = "select TopicID,topicname from topic where item=" & Request.QueryString("ItemID")这同你的写法一样...
不用request("ItemId") 将值直接写入sql语句中
改成 sql = "select TopicID,topicname from topic where(item='" & ss & "')" 加上: Dim con as sqlconnection con=new sqlconnection("connectionstring") con.open()
hllsmart(红烧肉) 写的我在vs.net中已经配置好的..不行 xxcw(Puma)说得对,直接用数值就对了...是itemid没有传到本页面中来..这是什么原因呢..代码如下: <asp:datalist id="datalist1" .....OnItemCommand="SelectItem"...../>Sub SelectItem(ByVal s As Object, ByVal e As DataListCommandEventArgs) Dim itemid, name As String name = e.CommandArgument itemid = DataList1.DataKeys.Item(e.Item.ItemIndex).ToString() Response.Redirect("WebForm2.aspx?ItemID=" & itemid & "itemname=" & name) End Sub 但我在webform2中调用itemID 却不行...itemID的值没有传过来?
sql = "select TopicID,topicname from topic where(item='" & ss & "')"
加上:
Dim con as sqlconnection
con=new sqlconnection("connectionstring")
con.open()
<asp:datalist id="datalist1" .....OnItemCommand="SelectItem"...../>Sub SelectItem(ByVal s As Object, ByVal e As DataListCommandEventArgs)
Dim itemid, name As String
name = e.CommandArgument
itemid = DataList1.DataKeys.Item(e.Item.ItemIndex).ToString()
Response.Redirect("WebForm2.aspx?ItemID=" & itemid & "itemname=" & name)
End Sub
但我在webform2中调用itemID 却不行...itemID的值没有传过来?