Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 27th, 2007, 05:00 PM
Authorized User
 
Join Date: Dec 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default caching

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"));

    Response.Write(userID);
}


</script>
<html>
<head>
    <title>Patient List</title>



</head>
<body >

<form runat="server">

    To sort click the appropriate column header<br /><br />
    <asp:GridView ID="gdPatientID"
     AllowSorting="true"
     AllowPaging="true"
     AutoGenerateEditButton="true"
     AutoGenerateDeleteButton="true"
     DataKeyNames="PatientID"
     CellPadding="5"
     HeaderStyle-BackColor="#BE7103"
     HeaderStyle-Font-Size="X-Small"
     runat="server"
     DataSourceID="SqlDataSource1"
     AutoGenerateColumns="false">
        <Columns>
            <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" />

        </Columns>
    </asp:GridView>
    <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 %>" />
    </form>

    </body>
</html>

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.

Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Caching stu9820 ASP.NET 3.5 Basics 0 June 20th, 2008 03:20 PM
Caching Amateur BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 February 9th, 2007 02:50 PM
caching? freaknfreak HTML Code Clinic 1 January 24th, 2006 12:10 PM
Caching bmains ASP.NET 1.x and 2.0 Application Design 4 February 27th, 2004 09:06 AM
.NEt Caching Mahavishnu VS.NET 2002/2003 0 February 17th, 2004 08:00 AM





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