Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

oracle-vb6-cr

Status
Not open for further replies.

vboracledba

Programmer
Jan 29, 2002
3
0
0
US
I would like to include CR in VB6 application.
I know how to do that.
What I don’t know how to retrieve creport with CRView activeX (pass user and password, pass sql query).
I would like to use Oracle Server if it is not possible
the Oracle Ole Db connection is fine.
Can you send me some sample?
Thank you,
Lazar
 
Sory i'm french....
I'm using a native connection to Oracle, the formula selection is send by VB6 like that :

CrystalReport1.ReportFileName = serveur & Acces
CrystalReport1.Connect = Str_Connect
CrystalReport1.SelectionFormula = selection
CrystalReport1.ParameterFields(0) = "TITRE;" & Titre & ";true"
CrystalReport1.Action = 0
it is well working with a formula selection on text or date fields, but when I make a selection on a number field, in the "Show SQL Query" CR is adding a "," just after the value, so the query is not correct.
Here is the CR SQL :
SELECT ...
FROM
.....
WHERE
myfield = 2371, AND
another field <= TO_DATE ('29-01-2002', 'DD-MM-YYYY')

Is there anybody who knows how to deal with it ???
 
I think you should do one or the other.

Either a) use .SelectionFormula to set the WHERE clause
or b) set the Selection Formula in Crystal Reports Designer using paramaters, and pass the parameter values in VB using .ParameterFields()

There is also
c) overwrite the whole SQL in VB using .SQLQueryString = &quot;SELECT...&quot; although I would not recommend this as a better way to do things.
 
thank you for answering, but

actually, I set the selectionformula in VB.
To test the selectionformula send by VB, I put the selectionformula directly in CR. And then I've seen that Cr translate the selectionformula by adding a comma after each number value ....

I also try to send the SQLQueryString, but I don't know how to write the query : do I have to use the cr syntax (with {} and all the quotes) or do I write the query in Sql mode ???

If you have some time to spend on this question...
thanks

(sorry for my very poor english...)
 
Thank you for your respond,
Could you send me some ample how to make connection
CrystalReport1.Connect = Str_Connect
Str_connect should be = &quot;server&quot;,&quot;user&quot;,&quot;pwd&quot; ????
I couldnt find any sample for oracle native connection.
Thank you
 
Here is how I made the connection in native Oracle :

CrystalReport1.Connect = &quot;DSN = SERVICE_NAME ;UID = user ;PWD = pathword&quot;
 
Thank you:
I am bit confuse,
Is it possible ( and it is normal) to store all report (as *.dsr) in vb application. If it is possible how to relate crview for some particular dsr.

I assume that the other way is to store all reports on server and than call tham from there.
 
The example code in this thread is for the OCX, not the RDC (which can involve the .DSR report files inside of a VB project).

I think the easiest way to deal with selection criteria is to create the criteria in Crystal using parameters and pass the parameter values from VB. If you're going to overwrite the entire query using .SQLQueryString you'll have to try the SQL and see if what it accepts. Usually it's something you do not want to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top