Lost as can be

Discussion in 'ASP .Net Datagrid Control' started by John K, Apr 3, 2004.

  1. John K

    John K Guest

    I am completely lost. I used a WebMatrix wizard and tried to make it a
    DataList. I get no errors but it doesn't work either. I really need help.
    Don't laugh too hard. I have been having a terrible time trying to figure
    this out. I just want to get this to bind and display properly in a tabular
    format. If it looks like I don't know very well what I'm doing then you'd be
    right. I've been up and down a lot of documentaion but I have just served to
    confuse myself more. I'm way on the wrong side of 50. This is something I do
    for my family which is very large and spread all over the country. I have a
    page doing this in ASP and it works fine but ASP.NET has thrown me pretty
    good. If I could get on the right track once I hope I can figure it out from
    there. Make necessary corrections and post the results if it isn't too much
    trouble.

    <%@ Page Language="VB" debug="true" %>
    <%@ import Namespace="System.Data" %>
    <%@ import Namespace="System.Data.OleDB" %>
    <script runat="server">

    Sub Page_Load
    Dim dstNewFmnfo As System.Data.DataSet
    Dim connectionString As String =
    "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data
    Source=G:/websites/krausyr/fpdb/newfami"& _
    "nfo.mdb"
    Dim dbConnection As System.Data.IDbConnection = New
    System.Data.OleDb.OleDbConnection(connectionString)

    Dim queryString As String = "SELECT [Results].[SpouseName],
    [Results].[CellPhone], [Results].[MaritalStatus], "& _
    "[Results].[Child_Of], [Results].[ZIP], [Results].[City],
    [Results].[MiddleName],"& _
    " [Results].[HomePhone], [Results].[State], [Results].[LastName],
    [Results].[Work"& _
    "Phone], [Results].[DateofBirth], [Results].[StreetAddress],
    [Results].[Key], [Re"& _
    "sults].[FirstName], [Results].[EmailAddress], [Results].[ChildrenNames]
    FROM [Re"& _
    "sults]"
    Dim dbCommand As System.Data.IDbCommand = New
    System.Data.OleDb.OleDbCommand
    dbCommand.CommandText = queryString
    dbCommand.Connection = dbConnection

    Dim dataAdapter As System.Data.IDbDataAdapter = New
    System.Data.OleDb.OleDbDataAdapter
    dataAdapter.SelectCommand = dbCommand
    Dim dataSet As System.Data.DataSet = New System.Data.DataSet
    dataAdapter.Fill(dstNewFmnfo)

    dlstNewFmnfo.DataSource = dstNewFmnfo
    dlstNewFmnfo.DataBind()


    End Sub

    </script>
    <html>
    <head>
    <title>Datalist.aspx</title>


    </head>
    <body>
    <form Runat="server">
    <asp:DataList ID="dlstNewFmnfo" Runat="Server">

    <HeaderTemplate>
    <h2>Fam Mbr First Name:</h2>
    </HeaderTemplate>

    <ItemTemplate>
    <table>
    <tr>
    <td align="right">First Name:</td>
    <td><%# Container.DataItem( "FirstName" )%></td>
    </tr>
    </ItemTemplate>

    </asp:DataList>

    </form>
    </body>
    </html>


    Thanks for your help, John K.
     
    John K, Apr 3, 2004
    #1
    1. Advertising

  2. John,
    post a specific problem so we can help you. Nobody likes to troubleshoot a
    wild goose.

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/27cok
    "John K" <> wrote in message
    news:...
    > I am completely lost. I used a WebMatrix wizard and tried to make it a
    > DataList. I get no errors but it doesn't work either. I really need help.
    > Don't laugh too hard. I have been having a terrible time trying to figure
    > this out. I just want to get this to bind and display properly in a

    tabular
    > format. If it looks like I don't know very well what I'm doing then you'd

    be
    > right. I've been up and down a lot of documentaion but I have just served

    to
    > confuse myself more. I'm way on the wrong side of 50. This is something I

    do
    > for my family which is very large and spread all over the country. I have

    a
    > page doing this in ASP and it works fine but ASP.NET has thrown me pretty
    > good. If I could get on the right track once I hope I can figure it out

    from
    > there. Make necessary corrections and post the results if it isn't too

    much
    > trouble.
    >
    > <%@ Page Language="VB" debug="true" %>
    > <%@ import Namespace="System.Data" %>
    > <%@ import Namespace="System.Data.OleDB" %>
    > <script runat="server">
    >
    > Sub Page_Load
    > Dim dstNewFmnfo As System.Data.DataSet
    > Dim connectionString As String =
    > "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data
    > Source=G:/websites/krausyr/fpdb/newfami"& _
    > "nfo.mdb"
    > Dim dbConnection As System.Data.IDbConnection = New
    > System.Data.OleDb.OleDbConnection(connectionString)
    >
    > Dim queryString As String = "SELECT [Results].[SpouseName],
    > [Results].[CellPhone], [Results].[MaritalStatus], "& _
    > "[Results].[Child_Of], [Results].[ZIP], [Results].[City],
    > [Results].[MiddleName],"& _
    > " [Results].[HomePhone], [Results].[State], [Results].[LastName],
    > [Results].[Work"& _
    > "Phone], [Results].[DateofBirth], [Results].[StreetAddress],
    > [Results].[Key], [Re"& _
    > "sults].[FirstName], [Results].[EmailAddress],

    [Results].[ChildrenNames]
    > FROM [Re"& _
    > "sults]"
    > Dim dbCommand As System.Data.IDbCommand = New
    > System.Data.OleDb.OleDbCommand
    > dbCommand.CommandText = queryString
    > dbCommand.Connection = dbConnection
    >
    > Dim dataAdapter As System.Data.IDbDataAdapter = New
    > System.Data.OleDb.OleDbDataAdapter
    > dataAdapter.SelectCommand = dbCommand
    > Dim dataSet As System.Data.DataSet = New System.Data.DataSet
    > dataAdapter.Fill(dstNewFmnfo)
    >
    > dlstNewFmnfo.DataSource = dstNewFmnfo
    > dlstNewFmnfo.DataBind()
    >
    >
    > End Sub
    >
    > </script>
    > <html>
    > <head>
    > <title>Datalist.aspx</title>
    >
    >
    > </head>
    > <body>
    > <form Runat="server">
    > <asp:DataList ID="dlstNewFmnfo" Runat="Server">
    >
    > <HeaderTemplate>
    > <h2>Fam Mbr First Name:</h2>
    > </HeaderTemplate>
    >
    > <ItemTemplate>
    > <table>
    > <tr>
    > <td align="right">First Name:</td>
    > <td><%# Container.DataItem( "FirstName" )%></td>
    > </tr>
    > </ItemTemplate>
    >
    > </asp:DataList>
    >
    > </form>
    > </body>
    > </html>
    >
    >
    > Thanks for your help, John K.
    >
    >
     
    Alvin Bruney [MVP], Apr 4, 2004
    #2
    1. Advertising

  3. John K

    John K Guest

    I started over from scratch because I found a link on the MS ASP.NET site
    that gave a complete example of a DataList using OleDB with Access. Just
    what I wanted to do. It represented the main structure and from there I was
    OK. I just wanted to make all the records appear in tabular form so users
    could scroll down and see each of the fields in each record. There are too
    many fields to use comfortably in that way with a DataGrid because you have
    to scroll horizontally and vertically (a pain in the butt). There are about
    150 records (family members) and some people like to scroll through them to
    refresh their memory about what kid belongs to whom etc. It takes six to
    eight seconds for this page to load but it isn't called that often. It's a
    little longer with dial up but still not too bad. Most people use the
    'Search' cause people typically look for a unique person. I have fields for
    spouse, parents, children, as well as addresses phone(s) and the like. We
    also have a lot of genealogy info dating back to the 1600s that one of my
    brothers has been compiling for years. That is in a different section of the
    site. We also have a section with a LOT of photos and members can upload
    photos.

    For my next trick I think I will make it so the records each display a
    picture of the person. We started planning a big family reunion last year
    for this summer and I'll be taking a photo of everyone with a digital
    camera. I don't know if Access can store pictures in JPG or if I will need
    to reference to a web folder that contains the images.

    I"ve had this site up and running for almost four years and decided to bite
    the bullet and change over to ASP.NET (from ASP). It's a lot of work and is
    challenging if you aren't a programmer. I originally had it all running on
    Server 2000 but my server was getting a bit long in the tooth so I built a
    new one last fall with Standard Server 2003. It works great!!

    Thanks Alvin. I'm sure I'll need help in the near future again.

    Later, John Kraus
     
    John K, Apr 4, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Thompson
    Replies:
    5
    Views:
    9,315
    Andrew Thompson
    Dec 12, 2003
  2. =?ISO-8859-15?Q?Josef_Bl=F6sl?=
    Replies:
    1
    Views:
    25,942
  3. MooMaster
    Replies:
    3
    Views:
    332
    Simon Brunning
    Jul 4, 2005
  4. Phil Powell

    Can't find syntax error in Access query - lost!

    Phil Powell, Jan 4, 2004, in forum: ASP General
    Replies:
    4
    Views:
    172
    Phil Powell
    Jan 5, 2004
  5. Francesco Moi

    I lost my 'perl' file. Where can I get it?

    Francesco Moi, Jul 26, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    76
    Simon Andrews
    Jul 29, 2003
Loading...

Share This Page