0

Hi guys I am trying to create a code that allows me to take either first name or last name or both and display accordingly on the gridview.. Much help is appreciated

viewrecords.aspx

<asp:AccessDataSource ID="AccessDataSource1" runat="server" 
        DataFile="~/App_Data/JABILMCALLEN.mdb" 
                
        
        SelectCommand="SELECT Employees.Name, TrainingDocuments.ReferenceDocument, TrainingDocuments.Description, Certifications.[Started Training], Certifications.[Ended Training], Certifications.TrainedBy, Certifications.Approved
FROM TrainingDocuments INNER JOIN (Employees INNER JOIN Certifications ON Employees.EmployeeID = Certifications.EmployeeID) ON TrainingDocuments.TrainingDocID = Certifications.TrainingDocID
WHERE (((Certifications.Approved)=Yes) AND ((Certifications.TrainingDocID)=[TrainingDocuments].[TrainingDocID]) AND ((Employees.Name)=@nameVar));">

<SelectParameters>
            <asp:QueryStringParameter Name="Name" QueryStringField="Name" Type="String" />
                   </SelectParameters>


    </asp:AccessDataSource>

code behind

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim nameVar As String = Request.QueryString("Name")

        If nameVar = "" Then
            Response.Redirect("Main.aspx") 'Handle empty submissions

        End If


    End Sub

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by RickyG
0

You should write,

string str="viewrecords.aspx?Name=" + textbox1.Text;
Response.Redirect(str);
0

Is this on the Search.aspx.vb code?

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Response.Redirect("ViewRecords.aspx?Name=" + Server.UrlEncode(txtName.Text))


      string str="viewrecords.aspx?Name=" + textbox1.Text;

      Response.Redirect(str);

    End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.