N
Neo Geshel
I am at my rope's end. Please, someone, help me or hang me!
I have (finally!!) been able to use ASP.NET to add records to an ACCESS
database. Now, all I need to do is count the number of rows that the
Access database has. I have tried about 8 different methods (of wildly
varying complexity... one method required four different files!), and
NONE of them work for me. Most examples are for SQL Server, which (for
some bizarre reason) will not install in my server (it hangs at the last
step). So I have to use an Access Database.
So far, this is the simplest example that I have been able to come up
with:
<%@ Page Language="VB"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.OleDb.OleDbDataAdapter" %>
<script language="VB" runat="server" debug="true">
Sub Page_Load(sender As Object, e As EventArgs)
Dim objConnection As OleDbConnection
Dim objCommand As OleDbCommand
Dim objDataReader As OleDbDataReader
Dim strSQLQuery As String
objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=c:\Inetpub\Web Sites\Metz\db\hitcount.mdb;")
strSQLQuery = "Select * From Browser"
objCommand = New OleDbCommand(strSQLQuery, objConnection)
objConnection.Open()
objDataReader = objCommand.ExecuteReader
(CommandBehavior.CloseConnection)
Dim DS as DataSet
DS = new DataSet()
objCommand.Fill(DS, "hits")
Dim RcdCount as Integer
RcdCount = DS.Tables("hits").Rows.Count.ToString()
ResultCount = RcdCount
RecordCount.Text = "There were " & RcdCount & " records found"
End Sub
</script>
<html>
<body>
<asp:label id="RecordCount" runat="server"></asp:label>
</body>
</html>
From this example, I get: Compiler Error Message: BC30456: 'Fill' is
not a member of 'System.Data.OleDb.OleDbCommand'.
However, EVERY database count example that I have come across makes use
of objCommand.Fill, and in almost the exact same way I have!!
HEEEELLLLPPPPPP!!!!!
How do I get the page to make use of objCommand.Fill without throwing an
error?
I like the power, but cannot understand the needless and illogical
complexity of asp.net. It seems like everything that took 10 lines to
code in normal ASP now takes 20 or more in asp.net. Couldn't MS have
simply added power and left out the complexity?
TIA to all those that take the time to help this poor sod.
....Geshel
--
************************************************************************
Reply-to e-mail forwards all received e-mails to SpamCop for UBE/UCE
(Unsolicited Bulk/Commercial E-mail) reporting. DO NOT USE THAT ADDRESS!
Please send e-mail to my first name at my last name dot org.
************************************************************************
I have (finally!!) been able to use ASP.NET to add records to an ACCESS
database. Now, all I need to do is count the number of rows that the
Access database has. I have tried about 8 different methods (of wildly
varying complexity... one method required four different files!), and
NONE of them work for me. Most examples are for SQL Server, which (for
some bizarre reason) will not install in my server (it hangs at the last
step). So I have to use an Access Database.
So far, this is the simplest example that I have been able to come up
with:
<%@ Page Language="VB"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.OleDb.OleDbDataAdapter" %>
<script language="VB" runat="server" debug="true">
Sub Page_Load(sender As Object, e As EventArgs)
Dim objConnection As OleDbConnection
Dim objCommand As OleDbCommand
Dim objDataReader As OleDbDataReader
Dim strSQLQuery As String
objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=c:\Inetpub\Web Sites\Metz\db\hitcount.mdb;")
strSQLQuery = "Select * From Browser"
objCommand = New OleDbCommand(strSQLQuery, objConnection)
objConnection.Open()
objDataReader = objCommand.ExecuteReader
(CommandBehavior.CloseConnection)
Dim DS as DataSet
DS = new DataSet()
objCommand.Fill(DS, "hits")
Dim RcdCount as Integer
RcdCount = DS.Tables("hits").Rows.Count.ToString()
ResultCount = RcdCount
RecordCount.Text = "There were " & RcdCount & " records found"
End Sub
</script>
<html>
<body>
<asp:label id="RecordCount" runat="server"></asp:label>
</body>
</html>
From this example, I get: Compiler Error Message: BC30456: 'Fill' is
not a member of 'System.Data.OleDb.OleDbCommand'.
However, EVERY database count example that I have come across makes use
of objCommand.Fill, and in almost the exact same way I have!!
HEEEELLLLPPPPPP!!!!!
How do I get the page to make use of objCommand.Fill without throwing an
error?
I like the power, but cannot understand the needless and illogical
complexity of asp.net. It seems like everything that took 10 lines to
code in normal ASP now takes 20 or more in asp.net. Couldn't MS have
simply added power and left out the complexity?
TIA to all those that take the time to help this poor sod.
....Geshel
--
************************************************************************
Reply-to e-mail forwards all received e-mails to SpamCop for UBE/UCE
(Unsolicited Bulk/Commercial E-mail) reporting. DO NOT USE THAT ADDRESS!
Please send e-mail to my first name at my last name dot org.
************************************************************************