locked
New to Coding, Running into problems. RRS feed

  • Question

  • User1260640038 posted

    Okay, so to start with I am entirely new to coding and have only done extremely simple html and css. I am currently learning how to link a access 2010 database to my IIS website running on windows 8. I am following many many tutorials and checked on hundred of forums trying to find answers as to why I am getting these error messages. I have created a DSN connected to my database. Everything "seems" to be fine but the bad part is I don't know what it should look like correct or not. Here is my code:

    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>JNET Database Connectiont</title>
    </head>
    
    <body>
    <% 
    Dim Connect, selectSQL, RecSet
    Set Connect = CreateObject ("ADODB.Connection")
    Connect.Open "DSN=Database"
    selectSQL = "SELECT * FROM hardware"
    Set RecSet = mConnect.Execute ("selectSQL")
    If NOT RecSet.EOF THEN
    DO UNTIL RecSet.EOF
    Response.Write RecSet("Companyname") & ", " & RecSet("Contactname") & "<BR><BR>"
    RecSet.MoveNext
    Loop
    End If
    RecSet.Close
    Connect.Close
    Set RecSet = Nothing
    Set Connect = Nothing
    %>
    </body>
    </html>

    I receive an error on line 11 (Set Connect = etc......) microsoft ole db provider for odbc drivers error '80004005' [microsoft][odbc driver manager] driver's sqlsetconnectattr failed.

    THEN I have this error message popping up: 

    Microsoft VBScript runtime error '800a01a8'

    Object required: ''

    /database.asp, line 10

    If SOMEONE could please assist me I would be greatly appreciative. I have been looking at this all day and can't seem to figure it out. I have made sure all my drivers are installed, so I know that is not a problem. I also have made sure all the proper permissions are set on the folders containing all the files. 

    Friday, October 3, 2014 12:28 PM

Answers

  • User-1199946673 posted

    THEN I have this error message popping up: 

    Microsoft VBScript runtime error '800a01a8'

    Object required: ''

    /database.asp, line 10

    You'rs using classic ASP (.asp). These forums are intended for ASP.NET related questions only. For classic ASP. find another forum. But if you start learning, the best option is to use ASP.NET. Go to "Get Started" and "Learn" menuitems on top of this page....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 4, 2014 7:57 PM

All replies

  • User1292124637 posted

    Alright, I'm assuming your using ASP.net Web Forms.

    An easy way to display data from an Access database in .NET 4.0 or higher is to use the <asp:AccessDataSource> and the <asp:GridView> controls.

    Here's the .aspx code for the content:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Access Data</title>
    </head>
    <body>
        <div>
            <h1>Data</h1>
            <form role="form" method="post" runat="server">
                <asp:AccessDataSource ID="AccessDataSource1" 
                                      runat="server" 
                                      DataFile ="~/App_Data/FrmSampl.mdb" 
                                      SelectCommand="SELECT * FROM [tblCustomers]">
    
                </asp:AccessDataSource>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="pkeyCustomerID" DataSourceID="AccessDataSource1" ForeColor="#333333" GridLines="None">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField DataField="pkeyCustomerID" HeaderText="pkeyCustomerID" ReadOnly="True" SortExpression="pkeyCustomerID" />
                        <asp:BoundField DataField="strCompanyName" HeaderText="strCompanyName" SortExpression="strCompanyName" />
                        <asp:BoundField DataField="strContactName" HeaderText="strContactName" SortExpression="strContactName" />
                        <asp:BoundField DataField="strContactTitle" HeaderText="strContactTitle" SortExpression="strContactTitle" />
                        <asp:BoundField DataField="strAddress" HeaderText="strAddress" SortExpression="strAddress" />
                        <asp:BoundField DataField="strCity" HeaderText="strCity" SortExpression="strCity" />
                        <asp:BoundField DataField="strRegion" HeaderText="strRegion" SortExpression="strRegion" />
                        <asp:BoundField DataField="strPostalCode" HeaderText="strPostalCode" SortExpression="strPostalCode" />
                        <asp:BoundField DataField="strCountry" HeaderText="strCountry" SortExpression="strCountry" />
                        <asp:BoundField DataField="strPhone" HeaderText="strPhone" SortExpression="strPhone" />
                        <asp:BoundField DataField="strFax" HeaderText="strFax" SortExpression="strFax" />
                    </Columns>
                    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                    <SortedAscendingCellStyle BackColor="#FDF5AC" />
                    <SortedAscendingHeaderStyle BackColor="#4D0000" />
                    <SortedDescendingCellStyle BackColor="#FCF6C0" />
                    <SortedDescendingHeaderStyle BackColor="#820000" />
                </asp:GridView>
            </form>
        </div>
    </body>
    </html>

    And to make things easy, here's a link from my OneDrive to the Visual Studio 2012 files (including project files) needed to test it out yourself.

    http://1drv.ms/1vAnlGO

    Note: The codebehind file for the project is in C#, but these controls are available in VB. So once you understand how to use them and toy around with them in VS, then you should be able to adapt what I have here to your own needs.

    Friday, October 3, 2014 1:58 PM
  • User-1199946673 posted

    THEN I have this error message popping up: 

    Microsoft VBScript runtime error '800a01a8'

    Object required: ''

    /database.asp, line 10

    You'rs using classic ASP (.asp). These forums are intended for ASP.NET related questions only. For classic ASP. find another forum. But if you start learning, the best option is to use ASP.NET. Go to "Get Started" and "Learn" menuitems on top of this page....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, October 4, 2014 7:57 PM