|
-
Aug 19th, 2004, 01:49 AM
#1
Thread Starter
New Member
how to change DB connection at runtime for CR using VB
Hi,
i have 2 MSSQL DBs.
im using DSN name to connect MSSQL DB to generate the report. for example, i have designed a report CR1 from the DB using dsn, named DSN1 which refers
the DB named Master1.
but now i want to connect the same report CR1 in a another dsn name called as
DSN2 which refers MSSQL DB named as Master2.
(because the both DB's have the same table, but i want the report to print from another DB's table. )
but at runtime if i do the coding from vb application like,
crystalreport1.connect = "DSN=DSN1"
(this coding works if the dsn name as DSN1)
its giving error msg like "error detected by database dll".
How could i make the data connectivity at runtime to point the different dsn name ie, DSN2. (consider i design the report manually at design mode of CR and connect the DB thru DSN ie, DSN1 refers Master1 DB and call it in vb application at runtime.)
-
Aug 19th, 2004, 11:43 PM
#2
Create an ADO connection in CR. Then you can use ADO in VB to
connect to any db and switch at run time. You can even create
recordsets to pass as the recordsource for the report over and
over again.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|