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
ataList 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
ataList>
</form>
</body>
</html>
Thanks for your help, John K.
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
<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
</form>
</body>
</html>
Thanks for your help, John K.