ASP.NET Connection String!

edited 10:22AM in FastReport .NET
Dear Sir:

I want to set ASP.NET common Connection String,
but in ASP.NET, there are no component like「environmentSettings」,
so how can i set it?
Thank you!

EX:
private void environmentSettings1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
{
e.ConnectionString = CONN;
}

Comments

  • edited 10:22AM
    You may use the following code:
    FastReport.Utils.Config.DatabaseLogin += new DatabaseLoginEventHandler(DatabaseLogin);
    
    private void DatabaseLogin(object sender, DatabaseLoginEventArgs e)
    {
      e.ConnectionString = CONN;
    }
    
  • edited March 2010
    AlexTZ wrote: »
    You may use the following code:
    FastReport.Utils.Config.DatabaseLogin += new DatabaseLoginEventHandler(DatabaseLogin);
    
    private void DatabaseLogin(object sender, DatabaseLoginEventArgs e)
    {
      e.ConnectionString = CONN;
    }
    

    Dear Sir:

    Where can i post thses code?
    in [ Page_load] ?

    and in [ FastReport.Utils.Config ] there are no [DatabaseLogin]
    so compiler fail!
  • edited 10:22AM
    Sorry, the correct code is

    FastReport.Utils.Config.ReportSettings.DatabaseLogin += ...

    You may call this code in the Page.Load event, but it is better to change the connection string in the WebReport.StartReport event:

    WebReport1.Report.Dictionary.Connections[0].ConnectionString = CONN;

    In this case, you don't need DatabaseLogin event.
  • edited 10:22AM
    AlexTZ wrote: »
    Sorry, the correct code is

    FastReport.Utils.Config.ReportSettings.DatabaseLogin += ...

    You may call this code in the Page.Load event, but it is better to change the connection string in the WebReport.StartReport event:

    WebReport1.Report.Dictionary.Connections[0].ConnectionString = CONN;

    In this case, you don't need DatabaseLogin event.

    The second option cannot work, at StartReport event WebReport1.Report.Dictionary has no Connection.
    But the first option mentioned in previous post on DatabaseLogin event is OK.
  • edited 10:22AM
    try this one..... Asp.Net Connection String

    Robert

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.