Option Strict On Option Explicit On Imports System.Data Imports System.Data.SqlClient Imports System.Drawing Imports CrystalDecisions.CrystalReports.Engine Public Class report Dim cryret As New ReportDocument Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load Dim rpt As New Invprt Dim myConnection As SqlConnection Dim MyCommand As New SqlCommand() Dim myDA As New SqlDataAdapter() Dim myDS As New Billing 'The DataSet you created. Try myConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=F:\jatin\sale\jatin_Data.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True") MyCommand.Connection = myConnection MyCommand.CommandText = "SELECT bills.docno" & _ ", bills.glc, bills.tc,sales.qty FROM BILLS INNER JOIN sales ON bills.tc = sales.tc and bills.docno=sales.docno order by bills.tc,bills.docno" MyCommand.CommandType = CommandType.Text myDA.SelectCommand = MyCommand myDA.Fill(myDS, "BILLS") rpt.SetDataSource(myDS) CrystalReportViewer1.ReportSource = rpt Catch Excep As Exception MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)