how to connect to report by code
Posted: Wed Sep 16, 2009 9:50 am
im new at Stimulsoft Reports.Net and tryed to read help but didnot find what i want
this code i use it to conect
Dim cn As New OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\Nwind2.accdb")
cn.Open()
Dim sql1 As String
Dim adp As OleDbDataAdapter
Dim da As New DataSet
sql1 = "select EmployeeID,LastName,FirstName from Employees where(Employees.EmployeeID=" & Me.TextBox1.Text & ")"
adp = New OleDbDataAdapter(sql1, cn)
adp.Fill(da, "Employees")
StiReport1.Load("StiReport1.mrt")
StiReport1.Dictionary.Databases.Clear()
StiReport1.Dictionary.DataSources.Clear()
StiReport1.RegData("da", da)
StiReport1.Dictionary.Synchronize()
StiReport1.Show()
so i must put all the text for all table.field when design report
this code didnot work also i use it with crystal report and worked well
this code i use it to conect
Dim cn As New OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\Nwind2.accdb")
cn.Open()
Dim sql1 As String
Dim adp As OleDbDataAdapter
Dim da As New DataSet
sql1 = "select EmployeeID,LastName,FirstName from Employees where(Employees.EmployeeID=" & Me.TextBox1.Text & ")"
adp = New OleDbDataAdapter(sql1, cn)
adp.Fill(da, "Employees")
StiReport1.Load("StiReport1.mrt")
StiReport1.Dictionary.Databases.Clear()
StiReport1.Dictionary.DataSources.Clear()
StiReport1.RegData("da", da)
StiReport1.Dictionary.Synchronize()
StiReport1.Show()
so i must put all the text for all table.field when design report
this code didnot work also i use it with crystal report and worked well