Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Variable not read right (syntax error)

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,37728
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Variable not read right (syntax error)
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Variable not read right (syntax error) - 9/13/2006 8:10:10 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
My goal is to query and display (html) some information from log files.
Everything's working except that when I use numbers in my variable (that I search for) the leading 0s get chopped off and letters are not taken at all. The latter produces "Syntax error (missing operator) in query expression 'Badge = 750D' Code: 80040E14"

I've researched the issue, but still can not see where I can force identify "Badge" as variable, and not integer. My code is below. It is mostly cobbled from different pieces of code, as this is my first fore into the VBScript world so please forgive the non-clarity of it.

I can also post the log.htm code if needed. I think the issue is probably with line 138 (if you c/p the code)

Thank you in advance for any/all help.



      
 
 
Post #: 1
 
 RE: Variable not read right (syntax error) - 9/14/2006 1:16:58 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
Does this work for you?

objRecordset.Open "Select * FROM " & strFile & " where Badge ='" & strBadge & "'", _
  objConnection, adOpenStatic, adLockOptimistic, adCmdText

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to user_s)
 
 
Post #: 2
 
 RE: Variable not read right (syntax error) - 9/14/2006 7:51:56 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
Ah, I've tried putting them virtually everywhere (but not where you mentioned)... thanks.

Unfortunately now I get the following error:

"Data type mismatch in criteria expression" (same line of code)
I'm currently looking into it.

Thanks much for your help.

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Variable not read right (syntax error) - 9/14/2006 7:54:55 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
Hmmm...it looks like you are pulling this from a delimited text file? Is that the case? If so, I would expect all the fields to be type string. Curious.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to user_s)
 
 
Post #: 4
 
 RE: Variable not read right (syntax error) - 9/14/2006 8:04:45 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
The original log is not comma delimited... I parse it (know exactly the length of each filed) into a comma delimited .txt with a header.

One clue to go by is that when I finally display that parse data, all my numerical values have trailing 0s cut off (ex: 0024 is 24). The values are fine in the parsed .txt

Thanks again!

(in reply to ebgreen)
 
 
Post #: 5
 
 RE: Variable not read right (syntax error) - 9/14/2006 8:06:20 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
Sorry.. it's been a long day.. above post should say:

"The original log is not comma delimited... I parse it (know exactly the length of each "field") into a comma delimited .txt with a header.

One clue to go by is that when I finally display that parse data, all my numerical values have initial 0s cut off (ex: 0024 is 24). The values are fine in the parsed .txt

Thanks again!

(in reply to user_s)
 
 
Post #: 6
 
 RE: Variable not read right (syntax error) - 9/14/2006 8:07:04 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
Could you post a mock up of the file with good values in it?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to user_s)
 
 
Post #: 7
 
 RE: Variable not read right (syntax error) - 9/14/2006 8:18:49 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
Here you go, thanks for taking the time.

STEP1
Please create temp_Output.txt in your c:\temp\  with the following text:

      


STEP2
Paste this into a new .hta file (ex: test.hta)



      

STEP3 Run the hta, putting the following values into the "Badge" field:
First "1234" ...perfect result
Second "0055" ...you see how it cut it down to "55"... but still works so ok
Lastly "999T" ...therein lies the problem.

(in reply to ebgreen)
 
 
Post #: 8
 
 RE: Variable not read right (syntax error) - 9/15/2006 2:30:17 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
Ok, this works (it fixess the problem with 0055 too). Use this code:


      

You will also need to put a Schema.ini file in the same directory as the data file. The Schema.ini file needs to contain:

      

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to user_s)
 
 
Post #: 9
 
 RE: Variable not read right (syntax error) - 9/15/2006 4:54:07 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
Thank you VERY much.

That gives me a working point.

(in reply to ebgreen)
 
 
Post #: 10
 
 RE: Variable not read right (syntax error) - 9/15/2006 8:19:52 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
One more (hopefully last) question.

I'm trying to work with more then one tempOutput.txt files (temp_Output.txt, temp_Output2.txt, temp_Output3.txt, etc.)

These files are same instructure but have different header names.

Would it still be possible to incorporate pulling data from multiple output files using your method? I've dropped the .ini and just pull values thusly:

      

I can't seem to however incoporate using variable (let's say ABC from the Output2.txt).... objRecordset.Fields.Item("ABC")

Thanks in advance.

(in reply to user_s)
 
 
Post #: 11
 
 RE: Variable not read right (syntax error) - 9/15/2006 8:35:57 AM   
  ebgreen


Posts: 5246
Score: 31
Joined: 7/12/2005
Status: online
You could easily pull from multiple files. I would suggest using an ini file though because it will make sure your data is handled correctly. You can just copy the ini block for temp_Output.txt in the ini and change the header for the block to the name of another file that you want to use. As an aside, using an ini file would let you avoid parsing the data into a temp file in the first place since it would support fixed length fields.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to user_s)
 
 
Post #: 12
 
 RE: Variable not read right (syntax error) - 9/18/2006 4:21:11 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
Yes thank.. I ran into that issue and took your advice. Works now. :) :)

(in reply to ebgreen)
 
 
Post #: 13
 
 RE: Variable not read right (syntax error) - 9/20/2006 3:43:37 AM   
  user_s

 

Posts: 16
Score: 0
Joined: 9/13/2006
Status: offline
Another question.

If I do

      

And later

      

For some reason my <td>s do not seem to take, meaning the overall boarder is seen but not the border lines between tds. BUT this is only the case while viewing the HTA. If I save the dataarea to an .html file, there I can see a normal table (with all the lines, etc)

Thanks in advance for your help.

< Message edited by user_s -- 9/20/2006 4:22:27 AM >

(in reply to user_s)
 
 
Post #: 14
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Variable not read right (syntax error) Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts