Solved

Vbscript : Syntax Error using Getstring (ADO)

Posted on 2011-09-20
4
925 Views
Last Modified: 2012-05-12
Hi,

I'm Using Vbscript to do a Request on a Oracle Database.
I'm using Getstring to put the output in a String then send it with Lotus Notes.
the problem is that Lotusscript ignores the CARRIAGE RETURN in my string.
So I wanted to change the Getstring options and I'm getting a syntax error and Idon't know why.

My Code :

connectionString = "DRIVER={Microsoft ODBC for Oracle};SERVER=SERVER;User Id=****;Password=****;"
ssql = "select Q3CPAI, Q3NUMG, Q3CTYM from hlmsenp, hlcriip "&_
"where q3cetm = '000' "&_
"And q3sens = '1' "&_
"And ( I0NA30 <>0 or I0NA40 <>0) "&_
"And q3scre = to_number(substr(to_char(sysdate,'YYYY'),1,2),'99') "&_
"And q3acre = to_number(substr(to_char(sysdate,'YYYY'),3,4),'99') "&_
"And q3mcre = to_number(to_char(sysdate,'MM'),'99') "&_
"And q3jcre = to_number(to_char(sysdate,'DD'),'99') "&_
"And i0nini in (select substr(q6nual, 9, 4) from hlmsiap where q6numg = q3numg)"
connADO.Open connectionString
Set rows = connADO.Execute(ssql)
rereq = rows.GetString(adClipString,3,,vbCrLf,)

I hope that I made myself understandable, if you need any more explainations just ask :)

Greetz,

Olivier
0
Comment
Question by:Yoo852
  • 2
4 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 36570590
VBscript or LotusScript ?? If this actually is LotusScript, I assume you didn't declare vbCrlf, nor did you specify Option Declare to force variables to be declared.

Add these lines:
      Dim vbCrlf As String
      vbCrlf= Chr$(13) & Chr$(10)
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 250 total points
ID: 36573191
In case you are using VBScript, you can do the same by putting as a first line in your script:

Option Explicit

Open in new window


Then of course you need to declare all your variables with Dim.

I just did that and it seems to me that what your missing is:

Const adClipString = 2

Open in new window


Maybe put that as the second line in your code.

I still got an error after that, I think you should just leave out the last comma if you want to use the default (empty string) for nulls:

rereq = rows.GetString(adClipString,3,,vbCrLf)

Open in new window

0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 36573422
Option Explicit is identical to Option Declare...
0
 

Author Closing Comment

by:Yoo852
ID: 36574508
I'm using Option Explicit.
for weeks I was searching for a solution, I changed almost everything to make it work ... except of course for the comma.
Many thx !!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question