Hi
I want my datasource type be "Data From Sql Connection" and I want to add it by code.
I write this code:
public class MyDataSource:Stimulsoft.Report.Dictionary.StiSqlSource
{
public MyDataSource(String conname,String name,String command):
base(conname,name,name,command,True,False,30)
{
}
}
-------------------------------------------
In My Evant:
StimulSoft.Report.StiReport report=new StimulSoft.Report.StiReport();
MyDataSource data = new MyDataSource("MyDBName","MyTableName","select field1,field2 from MyTableName");
data.Columns.AddRange(new StimulSoft.Report.Dictionary.StiDataColumn[] {
new StimulSoft.Report.Dictionary.StiDataColumn("field1","field1","field1",typeof(string)),
new StimulSoft.Report.Dictionary.StiDataColumn("field2","field2","field2",typeof(string))});
report.DataSources.Add(data);
report.RegData("MyDBName",MySqlConnection);
report.Design();
but when I want to edit my Datasource in design mode this error comes:Data Adaptor Not Found.
if it is possible to add a datasource in this way where my mistake is....
adding a "Data From Sql Connection"
adding a "Data From Sql Connection"
Hi
What was the product version number you used?
Thank you.
What was the product version number you used?
Thank you.
adding a "Data From Sql Connection"
Hi & Thank you
2008.1.129
2008.1.129
adding a "Data From Sql Connection"
Hello,
In init part of your application:
In your event:
Thank you.
Please use following code:ely wrote:I want my datasource type be "Data From Sql Connection" and I want to add it by code.
but when I want to edit my Datasource in design mode this error comes:Data Adaptor Not Found.
if it is possible to add a datasource in this way where my mistake is....
Code: Select all
public class MyDataSource : Stimulsoft.Report.Dictionary.StiSqlSource
{
public MyDataSource() : this("", "", "")
{
}
public MyDataSource(String conname, String name, String command) :
base(conname, name, name, command, true, false, 30)
{
}
}
public class MyDataSourceAdapter : Stimulsoft.Report.Dictionary.StiSqlAdapterService
{
public override string ServiceName
{
get
{
return "Data from MyData Connection";
}
}
public override Type GetDataSourceType()
{
return typeof(MyDataSource);
}
public MyDataSourceAdapter() : base()
{
}
}
Code: Select all
StiConfig.Services.Add(new MyDataSourceAdapter());
Code: Select all
Stimulsoft.Report.StiReport report = new Stimulsoft.Report.StiReport();
MyDataSource data = new MyDataSource("MyDBName", "MyTableName", "select field1,field2 from MyTableName");
data.Columns.AddRange(new Stimulsoft.Report.Dictionary.StiDataColumn[] {
new Stimulsoft.Report.Dictionary.StiDataColumn("field1","field1","field1",typeof(string)),
new Stimulsoft.Report.Dictionary.StiDataColumn("field2","field2","field2",typeof(string))});
report.DataSources.Add(data);
report.RegData("MyDBName", MySqlConnection);
report.Design();