468,765 Members | 1,035 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Same code, inconsistent results -- Please Help!

I have the two subs:

Sub UniqueHits()
Dim StrSQLQuery As String
Dim ObjAdapter as New OleDbDataAdapter()
Dim ObjDataSet as DataSet
StrSQLQuery = "SELECT * FROM Browser WHERE IsUnique = True"
ObjAdapter.SelectCommand = new OleDbCommand(StrSQLQuery,
ObjConnection)
ObjDataSet = new DataSet()
ObjAdapter.Fill(ObjDataSet,"hits")
Dim RcdCount as Integer
RcdCount = ObjDataSet.Tables("hits").Rows.Count.ToString()
UniqueHitCount.Text = "There have been " & RcdCount & " unique
visitors to your site."
End Sub
Sub TotalHitsGetMetz()
Dim StrSQLQuery As String
Dim ObjAdapter as New OleDbDataAdapter()
Dim ObjDataSet as DataSet
StrSQLQuery = "SELECT * FROM Browser WHERE Domain = 'domain.com'"
ObjAdapter.SelectCommand = new OleDbCommand(StrSQLQuery,
ObjConnection)
ObjDataSet = new DataSet()
ObjAdapter.Fill(ObjDataSet,"hits")
Dim RcdCount as Integer
RcdCount = ObjDataSet.Tables("hits").Rows.Count.ToString()
TotalHitCountGetMetz.Text = "GetMetz has been accessed " & RcdCount &
" times."
End Sub
The first one works perfectly. However, the second throws the following
error message:

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

Source Error:
Line 40: ObjAdapter.Fill(ObjDataSet,"hits")

What gives?? The code between the two are identical. There is no logical
difference between the two, and yet the second throws the error. I know
this, because removing the "WHERE Domain = 'domain.com'" makes it work
again. Problem is, my client uses up to 4 different domain names for his
web site, and I want to count the hits for each domain name.

IsUnique is a binary (yes/no) variable in the DB, and Domain is a
string. This is an Access db. Removing the single quotes from around the
Domain value makes no difference.

TIA to everyone that helps 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.
************************************************** **********************
Nov 17 '05 #1
2 1290
Chances are, "Domain" is a reserved word in Access. I'm not sure, though.
Try putting square brackets around the table name, as in:

StrSQLQuery = "SELECT * FROM Browser WHERE [Domain] = 'domain.com'"

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Neo Geshel" <go****@geshel.org> wrote in message
news:MP************************@shawnews.ok.shawca ble.net...
I have the two subs:

Sub UniqueHits()
Dim StrSQLQuery As String
Dim ObjAdapter as New OleDbDataAdapter()
Dim ObjDataSet as DataSet
StrSQLQuery = "SELECT * FROM Browser WHERE IsUnique = True"
ObjAdapter.SelectCommand = new OleDbCommand(StrSQLQuery,
ObjConnection)
ObjDataSet = new DataSet()
ObjAdapter.Fill(ObjDataSet,"hits")
Dim RcdCount as Integer
RcdCount = ObjDataSet.Tables("hits").Rows.Count.ToString()
UniqueHitCount.Text = "There have been " & RcdCount & " unique
visitors to your site."
End Sub
Sub TotalHitsGetMetz()
Dim StrSQLQuery As String
Dim ObjAdapter as New OleDbDataAdapter()
Dim ObjDataSet as DataSet
StrSQLQuery = "SELECT * FROM Browser WHERE Domain = 'domain.com'"
ObjAdapter.SelectCommand = new OleDbCommand(StrSQLQuery,
ObjConnection)
ObjDataSet = new DataSet()
ObjAdapter.Fill(ObjDataSet,"hits")
Dim RcdCount as Integer
RcdCount = ObjDataSet.Tables("hits").Rows.Count.ToString()
TotalHitCountGetMetz.Text = "GetMetz has been accessed " & RcdCount &
" times."
End Sub
The first one works perfectly. However, the second throws the following
error message:

Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException:
IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

Source Error:
Line 40: ObjAdapter.Fill(ObjDataSet,"hits")

What gives?? The code between the two are identical. There is no logical
difference between the two, and yet the second throws the error. I know
this, because removing the "WHERE Domain = 'domain.com'" makes it work
again. Problem is, my client uses up to 4 different domain names for his
web site, and I want to count the hits for each domain name.

IsUnique is a binary (yes/no) variable in the DB, and Domain is a
string. This is an Access db. Removing the single quotes from around the
Domain value makes no difference.

TIA to everyone that helps 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.
************************************************** **********************

Nov 17 '05 #2
In article <Oo*************@TK2MSFTNGP09.phx.gbl>,
ke***@DIESPAMMERSDIEtakempis.com says...
Chances are, "Domain" is a reserved word in Access. I'm not sure, though.
Try putting square brackets around the table name, as in:

StrSQLQuery = "SELECT * FROM Browser WHERE [Domain] = 'domain.com'"


Yippeeee!!! That did it!!

....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.
************************************************** **********************
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.