ODBC Connection

LMTLMT
edited 2:01AM in FastReport .NET
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:
     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

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.