Crystal Reports Datasource

Hi All

I have an external application that I connect to, unfortuantly for some reason both VB.net and Crystal Reports does not like connecting to it using Add New Datasource Wizard or the GUI's, so for my .net application I connect to it using code as follows..

Dim connectionstring As String
Dim querystring As String
Dim mods3 = New DataSet()
Dim i As Integer
Try
connectionstring = "DSN=MyDatabase; UID=" & TxtUN.Text & "; PWD=" & TxtPassword.Text
querystring = "SELECT * FROM MyTable "

querystring &= " ORDER BY MyField1 ASC "

Dim command As New Odbc.OdbcCommand(querystring)
Using connection As New Odbc.OdbcConnection(connectionstring)

command.Connection = connection
connection.Open()
command.ExecuteNonQuery()
'MessageBox.Show("Targets updated successfully")
End Using
Dim oAdapter As Odbc.OdbcDataAdapter

Try
oAdapter = _
New Odbc.OdbcDataAdapter(querystring, connectionstring)
oAdapter.Fill(mods3, "Downtime")
'MessageBox.Show("Targets updated successfully")
Catch oExcept As Exception
'MessageBox.Show("Targets not updated")
End Try
Catch ex As Exception
MsgBox(vbCrLf & ex.Message)

End Try


This works fine, I can use the populated dataset to return the values I need to specific fields on my form.

My question is this, can I use the above method so that I can create a crystal report? I know how to use code from a VB.Net form to pass parameters into a Crystal Report such as.

Dim dlgORpt As New ReportViewer dlgORpt.StoresListing1.SetParameterValue("MyParameter", MyParameter.Text)
dlgORpt.ShowDialog()

I just cant figure out how to create the datasorce for a crystal report programically as above..

Any help would be appreciated.

Cheers

Dougie
[2258 byte] By [1druid1] at [2007-11-20 11:49:02]
# 1 Re: Crystal Reports Datasource
Lots of sources on the Net, but I like this one:

http://www.businessobjects.com/products/reporting/crystalreports/default.asp
dglienna at 2007-11-10 3:08:14 >
# 2 Re: Crystal Reports Datasource
Hi

Thanks for the reply, although I am a little confused, I am already using Crystal Reports thats not the problem, my problem is connecting to a datasourse for Crystal Reports to use.

Regards

Douglas Bell
1druid1 at 2007-11-10 3:09:14 >