ODBC Connection
Dear friends,
Im new to FastReport and i need to create an ODBC connection and register it on the designer.
What I intend to do is:
- The user calls the designer that automatically register the ODBC connection and the tables that I pass.
- Drag and drop the fields on report.
- Serialize and save the design.
I had success on item 2 and 3.
I was writing something like:
I can see the connection folder and the registered table, but SOMETHING is missing... i get an error related to my connection. If a use the connection wizard it works perfectly using the same parameters that I use in this code.
Does anyone knows how to connect to ODBC by code?
Thank you
Fernando Mello
Im new to FastReport and i need to create an ODBC connection and register it on the designer.
What I intend to do is:
- The user calls the designer that automatically register the ODBC connection and the tables that I pass.
- Drag and drop the fields on report.
- Serialize and save the design.
I had success on item 2 and 3.
I was writing something like:
    OdbcDataConnection conexao = new OdbcDataConnection();
    conexao.Name = "DAT";
    conexao.ConnectionString = "Dsn=agcidade_comum;uid=SYSTEM;pwd=manager";
   Â
    TableDataSource tds = new TableDataSource();
    tds.Connection = conexao;
    tds.Table = this._DstDados.Tables[0];
    tds.TableName = this._DstDados.Tables[0].TableName;
    tds.SelectCommand = "select * from agilloba";
   Â
    conexao.Tables.Add(tds);
    rptRelatorio.Dictionary.Connections.Add(conexao);
    rptRelatorio.RegisterData(this._DstDados.Tables[0], this._DstDados.Tables[0].TableName);
    rptRelatorio.GetDataSource(this._DstDados.Tables[0].TableName).Enabled = true;
I can see the connection folder and the registered table, but SOMETHING is missing... i get an error related to my connection. If a use the connection wizard it works perfectly using the same parameters that I use in this code.
Does anyone knows how to connect to ODBC by code?
Thank you
Fernando Mello
Comments