Hi,
I am new to asp.net and am having difficulty using a variable posted from a previous page in a select statement.
I am posting a variable called "long_course_code" which comes across as AA103X9 to a page using the URL. I can grab the variable in the second page and write it to the page without any problem. What I want to do is only display information in the table where the variable comming over matches that in the database table. There is information there but I keep getting a blank page. Any help/advice would be most grateful. Thanks in advance The code can be seen below: -
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<% Dim StringText As String
StringText = Request.QueryString("long_course_code")
Response.Write(StringText)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<a name="pagetop"></a>
<div id="mainbody">
<table width="95%" cellpadding="0" cellspacing="0" border="0"
align="center">
<tr><td style="width: 845px; height: 348px;">
<table border="0" width="100%" id="table1">
<tr>
<td style="height: 82px"><img class="leftFloat" height="80"
alt="" src="" width="372"><br />
</td>
<td style="height: 82px"> </td>
<td width="183" style="height: 82px">
</tr>
</table>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:BoundField DataField="LIBRARY_NO" HeaderText="Library No" SortExpression="LIBRARY_NO" />
<asp:BoundField DataField="STUDENT_ID" HeaderText="Student ID" SortExpression="STUDENT_ID" />
<asp:BoundField DataField="SURNAME" HeaderText="SURNAME" SortExpression="SURNAME" />
<asp:BoundField DataField="FORENAMES" HeaderText="FORENAMES" SortExpression="FORENAMES" />
<asp:BoundField DataField="LATT" HeaderText="LATT" SortExpression="LATT" />
<asp:BoundField DataField="STUDENT_STATUS" HeaderText="Status" SortExpression="STUDENT_STATUS" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<br />
<span style="font-family: Arial"></span>
<asp:"S"qlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT * FROM "STUDENT" WHERE ("LONG_COURSE_CODE" = :"S"tringText)'>
<SelectParameters>
<asp:QueryStringParameter Name="LONG_COURSE_CODE" QueryStringField="StringText" Type="String" />
</SelectParameters>
</asp:"S"qlDataSource>
</div>
</form>
</body>
</html>