In my project, all my forms access the connection string from the login form which takes data from an XML file
Dim thisConnection As New SqlConnection(LoginForm1.cnString)
now when i create crystal reports. i first select a viewer which calls the report via code
cmd.Connection = thisConnection cmd.CommandType = CommandType.Text cmd.CommandText = "Select * from ATA_Pending" da.SelectCommand = cmd da.Fill(ds, "test") Dim strpath As String Dim strpath1 As String strpath = Application.StartupPath strpath1 = strpath.Remove(strpath.Length - 9, 9) + "ATAP.rpt" Dim cr As New ReportDocument cr.Load(strpath1) cr.SetDataSource(ds.Tables("test")) Me.crv1.ReportSource = cr
but i also want this viewer to provide a connection to the rpt file from "thisconnection". right now i'm manually connection from the rpt file. im not sure hw to go about this. suggestions will be appreciated.