' Determine if a Content ID has been passed in the query string
' If so use it as a variable in our SQL string to grab content for the page
' Httpcontext.Request.Querystring("Content_id")
Sub BindHomeBodyData() ' GRAB CONTENT *************************
Const strSQL as String = "SELECT * FROM Content WHERE Content_ID = " & Httpcontext.Request.Querystring("Content_id")
Dim myCommand as New SqlCommand(strSQL, myConnection)
Dim myDA as New SqlDataAdapter()
myDA.SelectCommand = myCommand
Dim myDS as New DataSet()
myDA.Fill(myDS)
dlHomeBodyData.DataSource = myDS
dlHomeBodyData.DataBind()
End SubNot tested:
Dim Content_ID As Integer = 1If Not IsNull(Request.QueryString("Content_id")) Then
Dim myRegEx As New RegEx("[^0-9]"), sContent As String = myRegEx.Replace(Request.QueryString("Content_id"), "")If sContent <> "" Then
Content_ID = CInt(sContent)
End If
End If
to take what you have given me and place it into what I have. Sorry I am an extreme newbie. Here is what I have is there any way you could educate me here and show me how to write this out according to my example. Thanks a lot I appreciate it.
Sub BindHomeBodyData() ' GRAB CONTENT *************************
Const strSQL as String = "SELECT * FROM Content WHERE Content_ID = " & Httpcontext.Request.Querystring("Content_id")
Dim myCommand as New SqlCommand(strSQL, myConnection)
Dim myDA as New SqlDataAdapter()
myDA.SelectCommand = myCommand
Dim myDS as New DataSet()
myDA.Fill(myDS)
dlHomeBodyData.DataSource = myDS
dlHomeBodyData.DataBind()
End Sub
0 comments:
Post a Comment