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


        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.

5 Years
Discussion Span
Last Post by choosechrist

As in from the rpt file. i take database expert. create a new connection. browse to ole db connection -> sql native client and from there fill in the details such as (server name, username, pasword etc). then i pull in the tables or views i want and drag the fields onto the report. i hope thats what you were asking?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.