VS 2005 Datagrid and MS Access

Last post 07-01-2009 11:52 AM by hans_v. 7 replies.

Sort Posts:

  • VS 2005 Datagrid and MS Access

    06-30-2009, 3:10 PM
    • Member
      40 point Member
    • dcjohnston
    • Member since 01-18-2006, 4:32 PM
    • Posts 16

     OK, this should be simple,

    I have written a very simple web page with a gridview that uses an access database. This page works fine on the workstation that I am working on, but if I publish it to the ASP.NET 2.0 supported IIS webserver the gridview will not load the data.

    No errors, it just times out after 90 seconds or so.

    I have the Access database in the App_data folder and all rights are good on the server.

    Is it possible the Access database is invisible to the form on the client workstation? I have given ASPNET access to the folder and I even published to the root of the website ( c:\inetpub\wwwroot)

    Any ideas?

    Dave

  • Re: VS 2005 Datagrid and MS Access

    06-30-2009, 10:19 PM

    It May be the query is taking more time, increase the command timeout property of the oledb command,

    and also it may be connection string issue also, check the below link for connection strings.

    http://www.connectionstrings.com/access

    Give a man a fish and you feed him for a day. Teach a man to fish and you feed him forever.
  • Re: VS 2005 Datagrid and MS Access

    07-01-2009, 9:10 AM
    • Star
      8,928 point Star
    • hans_v
    • Member since 01-29-2007, 4:03 PM
    • Posts 1,541

    dcjohnston:
    I have given ASPNET access to the folder
     

    What kind of access? You need so set MODIFY permissions

    http://www.mikesdotnetting.com/Article.aspx?ArticleID=74

    Also, could you post your HTML markup and code?

  • Re: VS 2005 Datagrid and MS Access

    07-01-2009, 9:11 AM
    • Star
      8,928 point Star
    • hans_v
    • Member since 01-29-2007, 4:03 PM
    • Posts 1,541

    ramireddyindia:
    It May be the query is taking more time
     

    90 seconds for a simple query?

  • Re: VS 2005 Datagrid and MS Access

    07-01-2009, 9:22 AM
    • Member
      40 point Member
    • dcjohnston
    • Member since 01-18-2006, 4:32 PM
    • Posts 16

     Thanks Ramir,

    However, I am not sure where to find the connection string. Well let me restate, I am using the query builder in VS2005 and under the connectionstrings tag in the web.config there is nothing under it (see below.)  The app works fine locally. The timeout without error may be a problem but of course locally it does not take that long.

    Correct me if I am wrong but the app runs on the server as ASPNET and thus ASPNET should have access to see the database correct? Given that, the only issue could be when I run this app locally it runs under my credentials and I have access to the database.

    This is really confusing me

    <configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>


     

     

  • Re: VS 2005 Datagrid and MS Access

    07-01-2009, 9:26 AM
    Answer
    • Star
      8,928 point Star
    • hans_v
    • Member since 01-29-2007, 4:03 PM
    • Posts 1,541

    dcjohnston:
    Correct me if I am wrong but the app runs on the server as ASPNET and thus ASPNET should have access to see the database correct?
     

    That depands. I don't think you read the link I provided:

    "for XP Pro machines, the user is the ASPNET account. On Windows Server 2003, 2008 and Vista, it is the NETWORK SERVICE account. However, if you have ASP.NET Impersonation enabled, the user account will be IUSR_machinename."

  • Re: VS 2005 Datagrid and MS Access

    07-01-2009, 11:24 AM
    • Member
      40 point Member
    • dcjohnston
    • Member since 01-18-2006, 4:32 PM
    • Posts 16

     You are correct Hans, I did not see your post, thanks for the reply,

    I checked my permissions and added the IUSR account and also the ASPNET account. Still not working.

    To test this problem I created a basic web project with a simple database with 10 lines of data. ( to test timing out)

    I created a website project and dragged a gridview to the form. Added the access database to the APP_Data folder.and selected two fields from the table (tblApps) in the database.

    Ran it locally and the grid loaded with the data. See code of the page below.

    If I run this from ANY webserver no good. Very odd.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
    
    <!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>
        <form id="form1" runat="server">
        <div>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1">
                <Columns>
                    <asp:BoundField DataField="CompName" HeaderText="CompName" SortExpression="CompName" />
                </Columns>
            </asp:GridView>
            <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/InstalledApps.mdb"
                SelectCommand="SELECT DISTINCT [CompName] FROM [tblApps]"></asp:AccessDataSource>
        
        </div>
        </form>
    </body>
    </html>


     

  • Re: VS 2005 Datagrid and MS Access

    07-01-2009, 11:52 AM
    • Star
      8,928 point Star
    • hans_v
    • Member since 01-29-2007, 4:03 PM
    • Posts 1,541

     It looks good, and since it is working on your local machne, the only thing I can think of is still a permisions issue....

Page 1 of 1 (8 items)