Specifying the connection type.

I want to force the source data to be the same as my running app, so I intend to hide the add data soource window and set it up through code.

I've read the documentation and I know I can use the following to specify the connection string...
private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
{
  e.ConnectionString = my_connection_string;
}

But how do I specify the connection type? (OleDb,MSAccess,XML,MSSQL, or even the plugin types, eg SQLlite, MySQL, and ODBC when you finish it?)

Thanks,

Anthony

Comments

  • edited 5:57AM
    You can try to use the new property (added yesterday):
    Config.DesignerSettings.ApplicationConnection
    assign your application connection object (such as SqlConnection) to this property, and the report will use it when you invoke the "Data|Add Data Source..." menu. Note that not all connection types are supported, because FR replaces actual connection object with its own connector (for example, if you specify the SqlConnection, FR will use its own MsSqlDataConnection).
  • edited September 2009
    Ok, so when your ODBC support is complete, I could pass an ODBCConnection object?

    So I could do this?
    ODBCConnection myCon;
    myCon = ....

    Config.DesignerSettings.ApplicationConnection= myCon;
    Report myReport = new Report();
    report.Design()

    and it should be already set with my database?

    If I do this, and then disable the "Add Data Source" menu item, then I can restrict the user to the database I choose, or must they use the "Add Data Source" to select the connection I passed? if so can I do this in code?

    Will the ODBC support be built in (I think it should as it adds support for a lot of databases and only uses built in .net classes), or will it be a plugin?

    if it's a plugin, will the passing an ODBCConnection work? and is it possible to ensure a plugin is loaded via code?

    Sorry about all the questions I keep asking, hopefully there shouldn't be too many more [img]style_emoticons/<#EMO_DIR#>/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> - Anthony[/img]
  • edited 5:57AM
    If you pass the connection object, it will be used in the "Data Wizard". You will be able to select tables in the existing connection, or create sql queries. You will not be able to select other connection (the first wizard page is disabled in this mode).

    I'm going to make Odbc connection built-in.

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.