Professional Web Applications Themes

Newbie: problem posting - ASP.NET General

Hi All, I've got the following .aspx file with the then following .cs code. The page renders fine on first run, but once I click the submit, it just comes back with a cannot be displayed page indicating that the page is not available. Anyone see what probably obvious or stupid thing I'm missing? TIA, John Test.aspx: ======== <% Page Language="C#" Src="Temp.cs" Inherits="dgrdAccountSort" %> <html> <head> </head> <body> <form runat="server"> <asp:datagrid id="grdAccount" runat="server" Height="100%" Width="100%"></asp:datagrid> <input type="submit" value="Submit Query" runat="server" /> </form> </body> </html> Temp.cs code: ========== using System; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.OleDb; public ...

  1. #1

    Default Newbie: problem posting

    Hi All,

    I've got the following .aspx file with the then following .cs code. The
    page renders fine on first run, but once I click the submit, it just comes
    back with a cannot be displayed page indicating that the page is not
    available. Anyone see what probably obvious or stupid thing I'm missing?

    TIA,

    John

    Test.aspx:
    ========

    <% Page Language="C#" Src="Temp.cs" Inherits="dgrdAccountSort" %>
    <html>
    <head>
    </head>
    <body>
    <form runat="server">
    <asp:datagrid id="grdAccount" runat="server" Height="100%"
    Width="100%"></asp:datagrid>
    <input type="submit" value="Submit Query" runat="server" />
    </form>
    </body>
    </html>


    Temp.cs code:
    ==========
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Data;
    using System.Data.OleDb;

    public class dgrdAccountSort : Page
    {
    private string SortExpression;
    protected DataGrid grdAccount;

    protected void Page_Load(object Src, EventArgs e)
    {
    BindGridReader();
    }


    public void BindGridReader()
    {
    string SelectCommand = "SELECT * FROM AcctName";
    if (SortExpression != null)
    SelectCommand += " ORDER BY " + SortExpression;

    OleDbConnection conn = new OleDbConnection("Provider=vfpoledb.1;User
    Id=;Password=;Data
    Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
    );
    OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );

    conn.Open();
    IDataReader reader = cmd.ExecuteReader();
    grdAccount.DataSource = reader;
    grdAccount.DataBind();

    conn.Dispose();
    }
    }


    John Guest

  2. #2

    Default Re: Newbie: problem posting

    John,

    Instead of Connection.Dispose();

    Use Connection.Close(); and then Connection.Dispose() instead.

    Connection.Dispose() tells the .Net garbage collector that it's okay to
    dispose of an object when it gets around to it. It does not close the
    connection.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "John Spiegel" <com> wrote in message
    news:phx.gbl... 
    Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice" 


    S. Guest

  3. #3

    Default Re: Newbie: problem posting

    Just a thought - have you tried closing the connection by setting the
    commandbehavior of your command to do so after the Datareader is closed. And
    then close the datareader after binding?

    "John Spiegel" <com> wrote in message
    news:phx.gbl... 
    Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice" 


    Rick Guest

  4. #4

    Default Re: Newbie: problem posting

    John,

    Sorry, but that was the only thing I could see that might have been wrong
    with your code...

    That said, I mostly program in VB.Net so maybe someone with more C#
    experience could spot something else to try.

    Good luck with it!

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "John Spiegel" <com> wrote in message
    news:phx.gbl... 
    pro [/ref][/ref]
    The [/ref]
    > comes [/ref]
    > missing? [/ref][/ref]
    OleDbConnection("Provider=vfpoledb.1;User 
    > >[/ref]
    >[/ref]
    Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice" 
    > >
    > >[/ref]
    >
    >[/ref]


    S. Guest

  5. #5

    Default Re: Newbie: problem posting

    Not yet, I'll give it a shot! I did find some very similar code code that
    is working so I can use it to find my mistake. Thanks for the advice, Rick!

    - John

    "Rick Spiewak" <com> wrote in message
    news:#phx.gbl... 
    And [/ref]
    comes [/ref]
    missing? 
    >[/ref]
    Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice" 
    >
    >[/ref]


    John Guest

  6. #6

    Default Re: Newbie: problem posting

    I appreciate the time looking into it! It's been a long time since I've
    picked up a new language so now I'm trying to basically do two at once!
    Yea! <g>

    "S. Justin Gengo" <com> wrote in message
    news:#phx.gbl... [/ref]
    first 
    > pro [/ref][/ref]
    to [/ref]
    > The 
    > > comes 
    > > missing? [/ref]
    > OleDbConnection("Provider=vfpoledb.1;User 
    > >[/ref]
    >[/ref]
    Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice" 
    > >
    > >[/ref]
    >
    >[/ref]


    John Guest

  7. #7

    Default Re: Newbie: problem posting

    FYI, As it turns out, the error seems to be tied to my not limiting the
    amount of the table it displayed on the page. Once I narrowed it down to 20
    rows at a time, the error went away. I'm not clear as to whether that's a
    configurable limitation or not.

    - John

    "John Spiegel" <com> wrote in message
    news:phx.gbl... 
    Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice" 


    John Guest

Similar Threads

  1. Newbie Problem
    By JAG in forum Ubuntu
    Replies: 6
    Last Post: September 21st, 03:42 AM
  2. newbie - Automaticaly Posting
    By monki in forum ASP Database
    Replies: 2
    Last Post: June 22nd, 05:39 AM
  3. Problem posting variables from a flash movie to C
    By bryan in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 12th, 05:09 PM
  4. problem posting data from asp form
    By Logan in forum ASP
    Replies: 3
    Last Post: October 17th, 04:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139