Connect to VistaDB

Hi there,

our application needs an connection to VistaDB. Therefor we've tried to compile FastReport.VistaDB.dll as described in recent readme.txt from FRNetConnections.zip.

We use FastReport.dll 1.2.1.0. But it doesn't work. We permanently get the following errors:

1. "FastReport.Data.VistaDBDataConnection" implementiert den geerbten abstrakten Member "FastReport.Data.DataConnectionBase.GetQuotationChars()" nicht. ...\VistaDBDataConnection.cs 12 16 FastReport.VistaDB
2. Fehler 2 "FastReport.Data.VistaDBDataConnection.QuoteIdentifier(string, System.Data.Common.DbConnection)": Es wurde keine passende Methode zum ??berschreiben gefunden. ...\VistaDBDataConnection.cs 36 28 FastReport.VistaDB


What goes wrong?

Regards Claus

Comments

  • edited 7:29PM
    Hello,

    Please use the latest version of FR.Net and FRNetConnections.zip. I've made some changes in the class architecture some time ago.
  • edited 7:29PM
    Hi,

    thanks for quick answer. Now access to VistaDB works. But a new problem came up.

    We need to present data from SQL server and from VistaDB by the same frx files. We tried to achieve this by solely changing the connectionstring that we hand over to viewer control. But it doesn't work. Is there a solution?

    Regards
    Claus

  • edited 7:29PM
    You have to replace the connection object with another one. It can be done in your app code before running a report.
  • edited 7:29PM
    Hi Alex,

    we had

    frReport = new FastReport.Report();
    this.frReport.Load(sFilename); // sFilename is frx file developed for SQL server

    and inserted the new lines of code

    FastReport.Data.VistaDBDataConnection dbConn = new FastReport.Data.VistaDBDataConnection();
    dbConn.Name = "Our_VistaDB";
    dbConn.ConnectionString = @...;
    this.frReport.Dictionary.Connections.Add(dbConn);
    dbConn.CreateAllTables();

    But CreateAllTables() throws the exeption

    Error 558 (Provider v. 3.5.3.83): Invalid operand(s) data type for operator: =
    Line #: 16; Column #: 21

    It seems it comes from VistaDB Provider but how to fix it? Against SQL server the report works fine. And VistaDB claims to be highly compatible with SQL server.

    Can You please give us an advice?

    Regards Claus
  • edited 7:29PM
    Hello,

    Sorry, I have no idea what it may be. In FastReport, the CreateAllTables() call is inside try..catch block. Try to do the same.
  • edited 7:29PM
    Hi Alex,

    we had a look at our report definition using your new designer. First we defined a query with one parameter (see pic. 1).
    Then the parameter was defined. This results in an error which is shown in picture 2?

    What goes wrong?

    Regards Claus
  • edited 7:29PM
    Hello,

    Try to change the VistaDBDataConnection.cs file:
        public override DbDataAdapter GetAdapter(string selectCommand, DbConnection connection,
          CommandParameterCollection parameters)
        {
          VistaDBDataAdapter adapter = new VistaDBDataAdapter(selectCommand, connection as VistaDBConnection);
          foreach (CommandParameter p in parameters)
          {
            VistaDBParameter parameter = adapter.SelectCommand.Parameters.Add(p.Name, (VistaDBType)p.DataType, p.Size);
            object value = p.Value;
            parameter.Value = value is Variant ? ((Variant)value).Value : value;
          }
          return adapter;
        }
    

    If it will help I'll include this fix into official version.
  • edited 7:29PM
    Hi Alex,

    it did solve this problem and we made a step forward.

    Now we're about to replace the OleDbDataConnection object by a VistaDBDataConnection object. But we're stumbled over the enumeration DataType.
    It seems that every provider uses an order of its own. And if so do You have a mapping?

    Regards Claus
  • edited 7:29PM
    Hello,

    No, we don't have a mapping method, you should implement your own one. It is essential for SQL query parameters only.
  • edited 7:29PM
    Hi Alex,

    now it really works. The same frx displays data either from SQL server or VistaDB.

    How do You think about a sample that shows how to programmatically build a report based on a SQL Query?
    In the manual I've only found one for Datasets.

    Many thanks for Your assistence
    Claus
  • edited 7:29PM
    I will include such topic in the next revision of the programmer's manual.
  • edited 7:29PM
    Hi Alex,

    some days ago I asked wether FastReport supports data provider factories. Do You remember.

    If such support is available, switching to another Database in done within one line of code.
    And there is no need to replace at runtime one DBConnection type by another. A tricky thing at least from my point of view.

    Once again many thanks for Your patiently support
    Claus

  • edited 7:29PM
    Hello,

    Sorry, factories are not supported. And, I don't see a way how to implement this. Different providers use different data types, different SQL dialects etc.

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.