Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 27th, 2007, 05:00 PM
Authorized User
 
Join Date: Dec 2005
Location: , , .
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

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:39 AM.


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