472,353 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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 1443
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: alanstew | last post by:
With the body tag calling out 'window onload', a function with a 'window.open' fails at the 'window.open' line. If I cut out the body tag, the...
2
by: JebBushell | last post by:
I see signs that the ASP.NET regular expression validator has a different instruction set that the Find utility in VS 2003. I am trying to use...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to...
33
by: genc_ymeri | last post by:
Hi over there, Propably this subject is discussed over and over several times. I did google it too but I was a little bit surprised what I read on...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.