cannot connect to sql server

edited 5:21AM in FastReport .NET
hai

i have created a report using sql server. i copied this report to another system , when i run i get error connecting to server , this is because server name is different from the other system, my question is how can i connect report using connection string from vb dotnet code.

thanks.

Comments

  • edited 5:21AM
    You have two options to pass the connection string from your application to a report:

    1. Pass the connection string directly to the Connection object:
    report.Dictionary.Connections[0].ConnectionString = "...";

    2. Use the EnvironmentSettings component, it can be added from VisualStudio Toolbox. In the DatabaseLogin event you may pass own connection string to the connection object that is defined in the report.
    private void report1_DatabaseLogin(object sender, DatabaseLoginEventArgs e)
    {
      e.Connection.ConnectionString = my_connection_string;
    }
    

Leave a Comment