G
Guest
I am ruinning this in the global.asa VIA Visual Studio VB .NET (framework 1.1)
I have a access database with a table called tblCounters with a feild called
Counters
with on row of data in it with a number. When I run the following code
Imports System.Data
Imports System.Data.OleDb
Sub Session_Start......
Dim dbconn As OleDbConnection
Dim dbasp As OleDbDataAdapter
Dim dbcmd As OleDbCommandBuilder
Dim dbdsn As New Dataset("tblCounters")
Dim dbtab As New DataTable("Counters")
Dim strcon As String
Dim strsql As String
Dim count As Double
Application.Lock()
strcon = "PROVIDER=Microsoft.Jet.4.0; DATA Source=C:\Folder\db1.mdb; User
id=admin;password=;"
strsql = "Select * From tblCounter"
dsconn = New OleDbConnection(strcon)
dbadp = New OleDbDataAdapter(strsql, dbconn)
dbcmd = New OleDbCommandBuilder(dbadp)
dbadp.Fill(dbdsn, "Counters")
At this point I should have filled the dataset dbdsn with a table called
"Counters" with one row of data, right? When I try and run this code
cnt = dbdsn.Rows(0).Item("Counters")
I get an error that my table has no rows.
When I look in the locals window under dbtab, the rows say 0 also?
Any suggestions?
Thanks
I have a access database with a table called tblCounters with a feild called
Counters
with on row of data in it with a number. When I run the following code
Imports System.Data
Imports System.Data.OleDb
Sub Session_Start......
Dim dbconn As OleDbConnection
Dim dbasp As OleDbDataAdapter
Dim dbcmd As OleDbCommandBuilder
Dim dbdsn As New Dataset("tblCounters")
Dim dbtab As New DataTable("Counters")
Dim strcon As String
Dim strsql As String
Dim count As Double
Application.Lock()
strcon = "PROVIDER=Microsoft.Jet.4.0; DATA Source=C:\Folder\db1.mdb; User
id=admin;password=;"
strsql = "Select * From tblCounter"
dsconn = New OleDbConnection(strcon)
dbadp = New OleDbDataAdapter(strsql, dbconn)
dbcmd = New OleDbCommandBuilder(dbadp)
dbadp.Fill(dbdsn, "Counters")
At this point I should have filled the dataset dbdsn with a table called
"Counters" with one row of data, right? When I try and run this code
cnt = dbdsn.Rows(0).Item("Counters")
I get an error that my table has no rows.
When I look in the locals window under dbtab, the rows say 0 also?
Any suggestions?
Thanks