Lost as can be

J

John K

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.
 
A

Alvin Bruney [MVP]

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 said:
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.
 
J

John K

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,083
Members
48,773
Latest member
Kaybee

Latest Threads

Top