Advertisement

07.03.2008 at 08:32AM PDT, ID: 23537206
[x]
Attachment Details

Using Query String Parameters on Page_load to db Retrieval

Asked by mconti41 in Visual Studio 2008, .Net Editors & IDEs, Microsoft Development

I want to take Query string parameters sent from another asp.net page and use them to do a sql query. I am getting in where clause variable is being used before assigned. The previous if statements assign the variable. I've included code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myGroupId As String
        Dim myStringMember As String
        Dim mySQLQuery As String

        If (Request.QueryString("grpId") <> Nothing) Then
            myGroupId = Request.QueryString("grpId").ToString().Trim()
        End If

        If (Request.QueryString("memId") <> Nothing) Then
            myStringMember = Request.QueryString("memId").ToString().Trim()
        End If

        mySQLQuery = "SELECT EENAMF, EENAML, EEGRP, EESSN, EECERT, EEIDNO, EEBDMT || '-' || EEBDDY ||  '-' || EEBDCY || EEBDYR AS BIRTHDT from Loomis.testprod.EMPMSTR WHERE EESSN = ('" & myStringMember & "')" & " and " & "(" & "EEGRP='" & myGroupId & "')"""

        SqlDataSourcePersonal.SelectCommand = mySQLQuery

        GridViewPersonal.DataBind()
    End SubStart Free Trial
[+][-]07.03.2008 at 09:46AM PDT, ID: 21927156

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 09:53AM PDT, ID: 21927204

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 09:59AM PDT, ID: 21927258

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 10:21AM PDT, ID: 21927415

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.03.2008 at 10:33AM PDT, ID: 21927518

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Studio 2008, .Net Editors & IDEs, Microsoft Development
Sign Up Now!
Solution Provided By: jorge_toriz
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628