Page 1 of 1

Creating Multiple databases and datatables at run-time

Posted: Tue Jan 30, 2007 1:26 am
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


Creating Multiple databases and datatables at run-time

Posted: Tue Jan 30, 2007 4:27 am
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.