I would like to thank all you guys for helping me. Finally let me just describe what i did to solve this problem of VB.NET, Crystal Reports and MySQL:
I followed instructions on this page for C# on this link
http://www.codeproject.com/KB/database/MySQLCrystal.aspx
and the code on this link (i just used the last four lines of the subroutine)
http://vb.net-informations.com/crystal-report/crystal_report_from_sql_query_string.htm
and made the code for VB.NET as follows:
Imports CrystalDecisions.CrystalReports.Engine
Imports MySql.Data.MySqlClient
Public Class frmViewReport
Dim conn As MySqlConnection
Dim daCompanies As New MySqlDataAdapter()
Dim dsCompanies As New DataSet()
Private Sub frmViewReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
conn = New MySqlConnection
Try
With conn
If .State = ConnectionState.Open Then .Close()
.ConnectionString = cnString
.Open()
End With
Catch ex As MySqlException
MsgBox(ex.ToString)
End Try
Try
Dim qryCompanies As String = "SELECT * FROM `tbl_permits`"
daCompanies.SelectCommand = New MySqlCommand(qryCompanies, conn)
Dim cb As MySqlCommandBuilder = New MySqlCommandBuilder(daCompanies)
daCompanies.Fill(dsCompanies, "tbl_permits")
Catch ex As MySqlException
MsgBox(ex.ToString)
Finally
conn.Close()
End Try
Dim objRpt As New Permit
objRpt.SetDataSource(dsCompanies.Tables("tbl_permits"))
rptViewer.ReportSource = objRpt
rptViewer.Refresh()
End Sub
End Class
I hope this would be useful for someone else......