p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 2.0 Professional (http://p2p.wrox.com/forumdisplay.php?f=215)
-   -   caching (http://p2p.wrox.com/showthread.php?t=54671)

jezywrap February 27th, 2007 05:00 PM

I'm using C# using Gridview connection to SQL. What I'm trying to do is a user will login and will be redirected to a page with a list of their patients. This is what I have at the moment

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Register TagPrefix="UserControl" TagName="Header" Src="Header.ascx" %>
<%@ Register TagPrefix="UserControl" TagName="Footer" Src="Footer.ascx" %>

<script language="C#" runat="server">

    String userID = "";

void Page_Load()

    userID = Convert.ToString(Cache.Get("ID"));


    <title>Patient List</title>

<body >

<form runat="server">

    To sort click the appropriate column header<br /><br />
    <asp:GridView ID="gdPatientID"
            <asp:BoundField ReadOnly="true" HeaderText="Patient Number" DataField="PatientID" SortExpression="PatientID" />
            <asp:BoundField HeaderText="First Name" DataField="FirstName" SortExpression="FirstName" />
            <asp:BoundField HeaderText="Last Name" DataField="LastName" SortExpression="LastName" />

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        SelectCommand="SELECT PatientID, FirstName, LastName FROM Patient Where FacilityID = userID"
        UpdateCommand="UPDATE Patient SET LastName = @LastName Where FacilityID = @FacilityID"
        DeleteCommand="Delete From Patient Where FacilityID=@FacilityID"
        ConnectionString="<%$ ConnectionStrings:User %>" />


The error I'm getting is

Invalid column name 'userID'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'userID'.

If there is a easier way to accomplish this I really need the assistance.


All times are GMT -4. The time now is 10:48 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.