Skip to Content
Former Member
May 13, 2014 at 09:43 AM

change crystal report data source dynamically failed with multi tables report


hello all

i have many reports created by someone else on his own machine using same database file i use

my application use Visual studio 2013 win form with crystal report pack 9

i use rpt files provided to me

connect database use OLEDB

to show form i use below code

SQLstr = " select what ever from table " ' defined as Public

reportName = rpt file path & report name


public sub showReport()

reportTable.clear() ' defined as Public

DBAdapter = new oleDpdataAdapter(SQLstr,DBconnection)


dim rptDoc as new Crystaldesicin.crystalreports.Engine.ReportDocument



formRpt.RptViewer.reportsource = rptDoc



when i use one table report with (select from one table) >>>>> works perfectly

but when i use report retrieve data from 2 tables and group data like using

SQLstr = " select 'table'.'coulumn', 'table2'.'column' ....... etc

from 'table1'

INNER JOIN 'table2' ON 'table'.'coulumn' = 'table2'.'column'

it's not working and formrpt shown but asking for database login

I noted that in database login window : server name refer to ORIGINAL DATABASE USED BY Report Creator not to my local database


i tried to set

rptDoc.datasourceconnection.item(0).setconnection("","databse file path and name", False)


but the same

using dataset instead of reportTable the same error


what i missed in this type of reports?

( apologize about long take and poor English )