Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Error 20599 in vb

Posted on 2003-11-28
12
Medium Priority
?
3,269 Views
Last Modified: 2012-05-04
I am getting this error while i'm trying to set the connection string of crystal report the error msg is error '20599' Cannot open SQL server.

Actually I have met this problem long time ago, but I have choose to avoid it by doing crp.connect="PWD="
Well, in the end i still need to programmatically set my connection string, my original setting is like

crp.connect="DSN=ADRIAN;UID=sa;PWD=;DSQ=Shipping"

May I know is there anything wrong with this, cos i keep getting this error, and I am sure that all the parameter is correct because i have successfully use same parameter to do my database connection for ADODB connection which is

"Provider=SQLOLEDB.1;Persist Security Info=False;" & _
                           "User ID=sa;password=ttnika;" & _
                           "Initial Catalog=Shipping" & ";Data Source=ADRIAN"

So, any expert out there please help me, cos i'm desperate searching the internet whole day and find no solution.

Secondly, I would like to know also, how can I programmatically use vb syntax to set the printer for crystal report?

thnx

0
Comment
Question by:biao81
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
12 Comments
 

Accepted Solution

by:
yadav_surender earned 100 total points
ID: 9841788
Instead of passing provider setup you can use this syntax

Report.database.setdatasource recordset,3,1  
and for printer setup you can pop up the printer window by giving this command
report.printersetup true
0
 

Author Comment

by:biao81
ID: 9849045
I solve the error open sql server, it's actually a careless mistake whereby i put my DSN name wrongly. well for report.printersetup,
it's actually report.printerselection, it works, so i think i will give the point to yaday_surrender for the printer part. but before this,
can u teach me how to pop up the printerselection only when user click on the little print button, cos currently, mine pop up whenever i
view a report even b4 i click on print.

what i do now is
crystalreport.action=1
crystalreport.printerselection


anyone pls advises
0
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 
LVL 101

Expert Comment

by:mlmcc
ID: 9854425
To avoid the printer setup screen showing before you click the print button, put the code in the print button click event not in the code that calls the report.

mlmcc
0
 

Author Comment

by:biao81
ID: 9854698
what is the name of the event then? i couldn't find it
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9855031
I believe it is PrintButton_Click

I don't have an appropriate CR & VB here to check it.

What code are you using to call the report?

What method OCX, RDC?

mlmcc
0
 

Author Comment

by:biao81
ID: 9856328
I believe there is no such event.

I am using OCX
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9863689
Sorry missed the .action = 1 which is the OCX.  You are correct the OCX doesn't have events.

As I recall the OCX has a PRINTERSELECTION button.  Enable that and tell the user to click it first, just as you have to from WORD with FILE--> PRINT rather than hitting the print button.

mlmcc
0
 

Expert Comment

by:yadav_surender
ID: 9873042
If it is not solved your problem of printer selection then you can use this way:
First take a common dialog control with components.  Name it DlgCmd
write button_click event
on error resume next
printer.setdefault=true  'For default printer
DlgCmd.flag=&H8 or &H100000
DlgCmd.ShowPrinter

'Common dialog control is under projects->components->Microsoft Common controls


Cheers
0
 

Expert Comment

by:sr_haneef
ID: 10274368
I am getting this error while i'm trying to set the connection string of crystal report the error msg is error '20599' Cannot open SQL server.
Crystal Report  version is 8.5.

The following is the code written in VB

CrystalReport1.ReportFileName = "c:\report1.rpt"
CrystalReport1.Connect = "Provider=sqloledb;Data Source=209.237.13.174;Initial Catalog=HerbalAdvisor;User ID=sa;Password=z4327928sIERRA99;"
    CrystalReport1.DiscardSavedData = True
    CrystalReport1.Action = 1

Can anybody help regarding this problem its very urgent.


0
 

Author Comment

by:biao81
ID: 10276846
hey, sr_haneef. initially this is the problem i post in this topic, but sounds like now I'm the one trying to help u, LOL.
You can try this, open ur report with crystal report itself. On the Menu, go to Database --> Set Location, and then for every table in the database,
remove the prefix of the table eg. if you see dbo.TableName, make it TableName. Remember to do it for every table. then click Done.
Save ur work, and it should solve ur problem.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10277670
sr_haneef
It is generally expected for you to open your own questions.

mlmcc
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

721 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