how to connect to report by code
-
- Posts: 7
- Joined: Wed Sep 16, 2009 9:41 am
- Location: egypt
how to connect to report by code
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
how to connect to report by code
This line here:
You need to make sure the first parameter matches your datasource when you originally created the report.
Looking at your previous code, maybe this needs to be
Code: Select all
StiReport1.RegData("da", da)
Looking at your previous code, maybe this needs to be
Code: Select all
StiReport1.RegData("Employees", da)
-
- Posts: 7
- Joined: Wed Sep 16, 2009 9:41 am
- Location: egypt
how to connect to report by code
still give me this message
c:\Documents and Settings\lighto soft\Local Settings\Temp\ikhavnwt.0.cs(56,40) : error CS0103: The name 'DataSource1' does not exist in the current contextc:\Documents and Settings\lighto soft\Local Settings\Temp\ikhavnwt.0.cs(61,40) : error CS0103: The name 'DataSource1' does not exist in the current contextc:\Documents and Settings\lighto soft\Local Settings\Temp\ikhavnwt.0.cs(66,40) : error CS0103: The name 'DataSource1' does not exist in the current context
can any tell how to do that im tired
:waaaht:
c:\Documents and Settings\lighto soft\Local Settings\Temp\ikhavnwt.0.cs(56,40) : error CS0103: The name 'DataSource1' does not exist in the current contextc:\Documents and Settings\lighto soft\Local Settings\Temp\ikhavnwt.0.cs(61,40) : error CS0103: The name 'DataSource1' does not exist in the current contextc:\Documents and Settings\lighto soft\Local Settings\Temp\ikhavnwt.0.cs(66,40) : error CS0103: The name 'DataSource1' does not exist in the current context
can any tell how to do that im tired
:waaaht:
how to connect to report by code
Hai,
1. Create Connection as cn, DataSource as Employees in DataDictionary in ur report.
2. Use the following in ur code:
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)
StiReport1.Load("StiReport1.mrt")
da.Tables.Item(0).TableName = "Employees"
StiReport1.DataSources.Clear()
StiReport1.Dictionary.Databases.Clear()
StiReport1.RegData("DataSource", da.Tables("Employees"))
StiReport1.Dictionary.Synchronize()
StiReport1.Render(False)
StiViewerControl1.Report = StiReport1
Regards
Jay
1. Create Connection as cn, DataSource as Employees in DataDictionary in ur report.
2. Use the following in ur code:
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)
StiReport1.Load("StiReport1.mrt")
da.Tables.Item(0).TableName = "Employees"
StiReport1.DataSources.Clear()
StiReport1.Dictionary.Databases.Clear()
StiReport1.RegData("DataSource", da.Tables("Employees"))
StiReport1.Dictionary.Synchronize()
StiReport1.Render(False)
StiViewerControl1.Report = StiReport1
Regards
Jay
-
- Posts: 7
- Joined: Wed Sep 16, 2009 9:41 am
- Location: egypt
how to connect to report by code
thank u so much you great
it works fine but the report font changed to other font every time when i filter the data want the report keep the selected
font when i filter the report
:feelgood: :feelgood: :feelgood:
it works fine but the report font changed to other font every time when i filter the data want the report keep the selected
font when i filter the report
:feelgood: :feelgood: :feelgood:
how to connect to report by code
I have tried a sample, font is not getting changed for me.
Can you explain me with some more information.
Regards
Jay
Can you explain me with some more information.
Regards
Jay