Private Sub itemrpt_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\ispat.mdb;Persist Security Info=True;Jet OLEDB:Database Password=admin" cn.Open() Dim da As New OleDbDataAdapter("select distinct item_name from m_item", cn) Dim ds As New DataSet da.Fill(ds) Dim i As Integer = 0 For i = 0 To ds.Tables(0).Rows.Count - 1 cmbitem.Items.Add(ds.Tables(0).Rows(i).Item(0).ToString) Next 'cmbID.SelectedIndex = 0 cmbitem.Text = a cn.Close() Catch ex As Exception MsgBox("E-itemRpeort Load") Finally End Try End Sub
Try Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\ispat.mdb;Persist Security Info=True;Jet OLEDB:Database Password=admin") cn.Open() Dim query As String = "Select * from t_purchase Where su_name='" & cmbsup.Text & "' and truck_no='" & cmbtruck.Text & "'and pu_id in(select pu_id from m_item where item_name='" & txtitem.Text & "'and sub_item='" & txtsubitem.Text & "')" Dim da As New OleDbDataAdapter(query, cn) Dim ds As New DataSet da.Fill(ds, "t_purchase") Dim query1 As String = "Select * from t_sale" Dim da1 As New OleDbDataAdapter(query1, cn) da1.Fill(ds, "t_sale") Dim query2 As String = "Select * from m_item Where item_name='" & cmbitem.Text & "' and sub_item='" & cmbsubitem.Text & "'" Dim da2 As New OleDbDataAdapter(query2, cn) da2.Fill(ds, "m_item") doc.Load(Application.StartupPath & "\item_rpt.rpt") doc.SetDataSource(ds) CrystalReportViewer1.ReportSource = doc doc.Refresh() cn.Close() Catch ex As Exception MsgBox(ex.ToString) End Try End Sub
report.SetDatabaseLogon(user, pwd)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)