Creating Multiple databases and datatables at run-time

Stimulsoft Reports.NET discussion
Post Reply
jing
Posts: 50
Joined: Fri Jan 26, 2007 12:47 am
Location: New Zealand

Creating Multiple databases and datatables at run-time

Post by jing »

Hi,

I am having problem using VB .NET to create multiple databases and datatables, so that the end-user will see a report with databases and datatables already filled in. (all they will need to do is to drag in the datafields)

I am not sure what is the syntax and have tried report.regdata, but it doesn't seem to work.

I have got so far

Code: Select all

Dim newR As New StiReport
Dim newDatabase As New Dictionary.StiSqlDatabase("Demo", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Stimulsoft\StimulReport.Net Demo\Bin\NWIND.MDB;Persist Security Info=False")
newR.Dictionary.Databases.Add(newDatabase)
Dim newDatabase2 As New Dictionary.StiSqlDatabase("New", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Stimulsoft\StimulReport.Net Demo\Bin\NWIND.MDB;Persist Security Info=False")
newR.Dictionary.Databases.Add(newDatabase2)
newR.Design()
but I don't think it's working....

Would anyone please help me on this?

thanks

Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Creating Multiple databases and datatables at run-time

Post by Edward »

jing wrote:Hi,

I am having problem using VB .NET to create multiple databases and datatables, so that the end-user will see a report with databases and datatables already filled in. (all they will need to do is to drag in the datafields)

I am not sure what is the syntax and have tried report.regdata, but it doesn't seem to work.
You can do the following:
1. Create a DataSet object in your Application and then create there all DataTables you need.

Code: Select all

Dim MyDataSet = new DataSet("MyDataSet")
2. Use RegData to register MyDataSet DataSet.

Code: Select all

newR.RegData(MyDataSet)
jing wrote: I have got so far

Code: Select all

Dim newR As New StiReport
Dim newDatabase As New Dictionary.StiSqlDatabase("Demo", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Stimulsoft\StimulReport.Net Demo\Bin\NWIND.MDB;Persist Security Info=False")
newR.Dictionary.Databases.Add(newDatabase)
Dim newDatabase2 As New Dictionary.StiSqlDatabase("New", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Stimulsoft\StimulReport.Net Demo\Bin\NWIND.MDB;Persist Security Info=False")
newR.Dictionary.Databases.Add(newDatabase2)
newR.Design()
For the connection with Access you have to change StiSqlDatabase to StiOleDbDatabase and code above allows you to register a Database object (without DataSources) for the StimulReport.Net.


Thank you.
Post Reply