473,554 Members | 2,815 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Same code, inconsistent results -- Please Help!

I have the two subs:

Sub UniqueHits()
Dim StrSQLQuery As String
Dim ObjAdapter as New OleDbDataAdapte r()
Dim ObjDataSet as DataSet
StrSQLQuery = "SELECT * FROM Browser WHERE IsUnique = True"
ObjAdapter.Sele ctCommand = new OleDbCommand(St rSQLQuery,
ObjConnection)
ObjDataSet = new DataSet()
ObjAdapter.Fill (ObjDataSet,"hi ts")
Dim RcdCount as Integer
RcdCount = ObjDataSet.Tabl es("hits").Rows .Count.ToString ()
UniqueHitCount. Text = "There have been " & RcdCount & " unique
visitors to your site."
End Sub
Sub TotalHitsGetMet z()
Dim StrSQLQuery As String
Dim ObjAdapter as New OleDbDataAdapte r()
Dim ObjDataSet as DataSet
StrSQLQuery = "SELECT * FROM Browser WHERE Domain = 'domain.com'"
ObjAdapter.Sele ctCommand = new OleDbCommand(St rSQLQuery,
ObjConnection)
ObjDataSet = new DataSet()
ObjAdapter.Fill (ObjDataSet,"hi ts")
Dim RcdCount as Integer
RcdCount = ObjDataSet.Tabl es("hits").Rows .Count.ToString ()
TotalHitCountGe tMetz.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.Ole Db.OleDbExcepti on:
IErrorInfo.GetD escription failed with E_FAIL(0x800040 05).

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

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 1498
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.s hawcable.net...
I have the two subs:

Sub UniqueHits()
Dim StrSQLQuery As String
Dim ObjAdapter as New OleDbDataAdapte r()
Dim ObjDataSet as DataSet
StrSQLQuery = "SELECT * FROM Browser WHERE IsUnique = True"
ObjAdapter.Sele ctCommand = new OleDbCommand(St rSQLQuery,
ObjConnection)
ObjDataSet = new DataSet()
ObjAdapter.Fill (ObjDataSet,"hi ts")
Dim RcdCount as Integer
RcdCount = ObjDataSet.Tabl es("hits").Rows .Count.ToString ()
UniqueHitCount. Text = "There have been " & RcdCount & " unique
visitors to your site."
End Sub
Sub TotalHitsGetMet z()
Dim StrSQLQuery As String
Dim ObjAdapter as New OleDbDataAdapte r()
Dim ObjDataSet as DataSet
StrSQLQuery = "SELECT * FROM Browser WHERE Domain = 'domain.com'"
ObjAdapter.Sele ctCommand = new OleDbCommand(St rSQLQuery,
ObjConnection)
ObjDataSet = new DataSet()
ObjAdapter.Fill (ObjDataSet,"hi ts")
Dim RcdCount as Integer
RcdCount = ObjDataSet.Tabl es("hits").Rows .Count.ToString ()
TotalHitCountGe tMetz.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.Ole Db.OleDbExcepti on:
IErrorInfo.GetD escription failed with E_FAIL(0x800040 05).

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

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***@DIESPAMME RSDIEtakempis.c om 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
2418
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 function executes as normal. At first I thought it was the entire function failing, but I tested with alerts and found that it was only the 'window.open' that fails to execute. The function is being...
2
1486
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 the VS2003 regular expression Find tool to test regular expressions for use in a ASP.NET validator. The results I am getting are inconsistent . What works in VS does not always work in ASP.NET and...
6
4829
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 another field. Ex. SalesManID SalesManName AT Alan Time
33
4646
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 internet when it comes 'when to use what'. Most of articles I read from different experts and programmers tell me that their "gut feelings" for using stringBuilder instead of string concatenation...
0
7579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7499
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7780
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8013
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5414
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3539
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.