adding a "Data From Sql Connection"
Posted: Mon Jan 25, 2010 4:43 am
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....
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....