Yes, I use code as bellow:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rpt As New MyReport 'The report you created.
Dim myConnection As SqlConnection
Dim MyCommand As New SqlCommand
Dim myDA As New SqlDataAdapter
Dim myDS As New dstRpt 'The DataSet you created.
Dim MyConnectionString As String
MyConnectionString = ConfigurationSettings.AppSettings(WEBSERVER)
myConnection = New SqlConnection(MyConnectionString) 'from web.config
MyCommand.Connection = myConnection
MyCommand.CommandText = MYSQL
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "tblOrder")
rpt.SetDataSource(myDS)
rpt.PrintToPrinter(1, False, 0, 0)
Me.crvOrder.ReportSource = rpt 'CR viewer
End Sub
If I bind to a test datagrid using myDS, I got data from SQL server which is in another machine. The only thing look like did not work is:
rpt.SetDataSource(myDS)