Search found 66 matches

by Eden0928
Wed 26 Oct 2022 09:56
Forum: dbExpress driver for SQL Server
Topic: What is "Serializable Transaction"
Replies: 0
Views: 145733

What is "Serializable Transaction"

In "New in dbExpress Drivers: Support for RAD Studio 11 Alexandria Release 2 and Microsoft OLE DB Driver for SQL Server 19"
https://blog.devart.com/new-in-dbexpres ... er-19.html
Also, we added support for the serializable transaction.
What is "serializable transaction"?

Have about it example?

Thx.
by Eden0928
Fri 20 May 2022 00:55
Forum: dbExpress driver for SQL Server
Topic: "TrimFixedChar" only works with Char Type?
Replies: 2
Views: 10498

Re: "TrimFixedChar" only works with Char Type?

That is very helpful! Thank you!

Please remember to add it in the manual. :)
by Eden0928
Fri 13 May 2022 07:42
Forum: dbExpress driver for SQL Server
Topic: "TrimFixedChar" only works with Char Type?
Replies: 2
Views: 10498

"TrimFixedChar" only works with Char Type?

I tested using four literal types: varchar, char, nvarchar, nchar, dfm and code as below:

dfm :

Code: Select all

object Form1: TForm1
  Left = 0
  Top = 0
  Caption = 'Form1'
  ClientHeight = 299
  ClientWidth = 635
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object DBGrid1: TDBGrid
    Left = 176
    Top = 91
    Width = 320
    Height = 120
    DataSource = DataSource1
    TabOrder = 0
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'Tahoma'
    TitleFont.Style = []
  end
  object SQLConnection1: TSQLConnection
    ConnectionName = 'DEVART SQL SERVER DIRECT'
    DriverName = 'DevartSQLServerDirect'
    GetDriverFunc = 'getSQLDriverSQLServerDirect'
    LibraryName = 'dbexpsda40.dll'
    LoginPrompt = False
    Params.Strings = (
      'BlobSize=-1'
      'HostName=.\SQLEXPRESS'
      'DataBase=ADBDEMOS'
      'DriverName=DevartSQLServerDirect'
      'User_Name='
      'Password='
      'LongStrings=True'
      'EnableBCD=True'
      'FetchAll=True'
      'TrimFixedChar=True')
    VendorLib = 'not used'
    Connected = True
    Left = 128
    Top = 72
  end
  object SQLQuery1: TSQLQuery
    MaxBlobSize = -1
    Params = <>
    SQL.Strings = (
      
        'select '#39'hi '#39' as VarChar, CAST('#39'hi '#39' AS CHAR(3)) AS Char, Cast('#39'h' +
        'i '#39' as nvarchar(3)) as NVarChar, CAST('#39'hi '#39' AS NCHAR(3)) AS NCha' +
        'r')
    SQLConnection = SQLConnection1
    Left = 136
    Top = 128
  end
  object DataSetProvider1: TDataSetProvider
    DataSet = SQLQuery1
    Left = 296
    Top = 88
  end
  object DataSource1: TDataSource
    DataSet = ClientDataSet1
    Left = 368
    Top = 96
  end
  object ClientDataSet1: TClientDataSet
    Aggregates = <>
    Params = <>
    ProviderName = 'DataSetProvider1'
    Left = 312
    Top = 152
  end
end
Unit Code :

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DBXDevartSQLServer, FMTBcd, DB, StdCtrls, Mask, DBCtrls, DBClient,
  Provider, SqlExpr, Grids, DBGrids;

type
  TForm1 = class(TForm)
    SQLConnection1: TSQLConnection;
    SQLQuery1: TSQLQuery;
    DataSetProvider1: TDataSetProvider;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    ClientDataSet1: TClientDataSet;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  ClientDataSet1.Close;
  ClientDataSet1.Open;
end;

end.
As you can see, only Char and NChar trailing spaces are trimmed, but varchar and Nvarchar are not.

My environment :
dbx driver for SQL SERVER version 9.1.1
Delphi XE, XE7
Windows 10

Is there a parameter similar to "TrimFixedVarChar" ?
by Eden0928
Thu 24 Feb 2022 02:42
Forum: dbExpress driver for SQL Server
Topic: Got "Operation Not Supported" message when run to RecordCount.
Replies: 1
Views: 10041

Got "Operation Not Supported" message when run to RecordCount.

I have a SQL:

Code: Select all

SELECT COLUMN_NAME AS name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + '.' + CONSTRAINT_NAME), 'IsPrimaryKey') = 1 AND TABLE_NAME = 'TBNAME' AND TABLE_SCHEMA = 'dbo'
AND Delphi Code:

Code: Select all

function v_FetchQueryPrimaryKey(A_Query: TSQLQuery; A_TableName: string): string;
var
  LColumnDS: TSQLQuery;
  LColumnField: TField;
begin
  Result := '';
  if A_TableName = '' then Exit;

  LColumnDS:= TSQLQuery.Create(A_Query);
  LColumnDS.SQLConnection := A_Query.SQLConnection;
  try
    LColumnDS.SQL.Text :=
      Format('SELECT COLUMN_NAME AS name FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE OBJECTPROPERTY(OBJECT_ID(CONSTRAINT_SCHEMA + ''.'' + CONSTRAINT_NAME), ''IsPrimaryKey'') = 1 '
            +'AND TABLE_NAME = ''%s'' AND TABLE_SCHEMA = ''dbo'' ', [A_TableName]);
    LColumnDS.Open;
    LColumnField := LColumnDS.Fields[0];
    while not LColumnDS.Eof do
    begin
      if A_Query.FindField(LColumnField.AsString) <> nil then begin
        Result := Result + UpperCase(LColumnField.AsString);

        if LColumnDS.RecNo <> LColumnDS.Recordcount then  // <- NOTE LColumnDS.Recordcount!
          Result := Result + ',';
      end;

      LColumnDS.Next();
    end;
  Finally
    FreeAndNil(LColumnDS);
  end;
end;
TSQLQuqery.RecordCount will run to TCustomSQLDataSet.GetRecordCount ,however "Query := Query + GetQuoteChar + TableName + GetQuoteChar", the "GetQuoteChar" under ISAPI you will get the ["] values (Under EXE I get empty string, which is the correct result).

I got the error message:"Operation Not Supported" in ISAPI mode.

Keep following the "GetQuoteChar" source code, it seems to come from the MetaData driver, the Devart DBX Driver.

Any ideas on whether this is a bug or not and if so where?

My environment:
  • Windows 10 and Windows Server 2012 IIS
  • SQL Server 2014
  • Delphi XE7
  • dbexpress for SQL Server 9.0.1 and used DevartSQLServerDirectBuiltin mode.
by Eden0928
Thu 02 Dec 2021 03:30
Forum: dbExpress driver for SQL Server
Topic: Project Compiler Error in dbExpress for SQL Server with source
Replies: 2
Views: 16010

Re: Project Compiler Error in dbExpress for SQL Server with source

What is "Add LITE;DBX40 to conditional defines of your project."

Could you give me the simple built-in project?
by Eden0928
Thu 02 Dec 2021 03:07
Forum: dbExpress driver for SQL Server
Topic: Project Compiler Error in dbExpress for SQL Server with source
Replies: 2
Views: 16010

Project Compiler Error in dbExpress for SQL Server with source

I create an empty project and add related units.

My environment :
dbExpress for SQL Server with source 9.0.1
Delphi XE (150)
Windows 10 64bit

Code: Select all

unit Unit2;

interface

uses
  DBXCommon, Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dbxsda, DBXDevartSQLServer, DB, SqlExpr;

type
  TForm2 = class(TForm)
    SQLConnection1: TSQLConnection;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

initialization
    RegisterDbXpressLib(@getSQLDriverSQLServer);

end.
But an error message will appear in the source code when compiling:
[DCC Error] dbexp.pas(2164): E2010 Incompatible types: 'Boolean' and 'Word'

Code: Select all

procedure TMemSQLCursor.GetField(FieldNo: word; Buffer: pointer; var IsBlank: LongBool);
...
    FRecordSet.GetField(Field, FRecBuf, Buffer, BufferLen, False, _IsBlank);
...
Why?
by Eden0928
Mon 26 Jul 2021 05:59
Forum: dbExpress driver for SQL Server
Topic: How to connnect the SQL SQL SERVER Express in Direct Mode?
Replies: 3
Views: 17218

Re: How to connnect the SQL SQL SERVER Express in Direct Mode?

Stellar wrote: Fri 23 Jul 2021 11:57 Hello,

If you are not able to connect to the server in the Direct mode, but connection is successfully established through OLE DB, the most probable reason for this is that a TCP connection to the server is not allowed.

You can use the documentation to configure a remote connection to the server:
blogs.msdn.microsoft.com/walzenbach/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008/
support.microsoft.com/en-us/help/968872/how-to-open-the-firewall-port-for-sql-server-on-windows-server-2008#LetMeFixItMyselfAlways

Should you have any questions, do not hesitate to ask!
Best regards,
Sergey
Devart Team
www.devart.com
Yes, After setting TCP/IP protocal to "Enabled", Direct Mode is ready to use!

Thank you!
by Eden0928
Fri 23 Jul 2021 03:24
Forum: dbExpress driver for SQL Server
Topic: How to connnect the SQL SQL SERVER Express in Direct Mode?
Replies: 3
Views: 17218

How to connnect the SQL SQL SERVER Express in Direct Mode?

Windows authentication in the Direct mode is supported
I set the sqloledb mode, the setting below :
HostName=.\SQLEXPRESS
DataBase=master
DriverName=DevartSQLServer

It can success connected.

But, I change to Direct Mode, setting below :
HostName=.\SQLEXPRESS
DataBase=master
DriverName=DevartSQLServerDirect

I get the "Cannot connect to server on host 'localhost'. Socket Error Code 10061 ($274D)" error message.

My dbexpress driver for SQL SERVER version is 7.5.7.

I wonder if I have missed any details.

Best regards.
by Eden0928
Mon 03 May 2021 00:52
Forum: dbExpress driver for SQL Server
Topic: Could dbexpsda40.dll not exist in Deployment?
Replies: 3
Views: 21056

Re: Could dbexpsda40.dll not exist in Deployment?

Learn superb information!

I already have the Standard version, will there be a discount for upgrading to "With Source" in the future? (hopefully more than 25%)

Looking forward to it!
by Eden0928
Sun 02 May 2021 05:41
Forum: dbExpress driver for SQL Server
Topic: TSQLMonitor not supported on Delphi 10.4 Pro.
Replies: 5
Views: 22524

Re: TSQLMonitor not supported on Delphi 10.4 Pro.

Yes, I also can't reproduce this error when creating a new project. The error may be caused by the unstable environment at the time.

Finally, I want to emphasize that "Dbexpress driver for SQL server" supports TSQLMonitor components.

Devart is great!
by Eden0928
Wed 28 Apr 2021 07:25
Forum: dbExpress driver for SQL Server
Topic: TSQLMonitor not supported on Delphi 10.4 Pro.
Replies: 5
Views: 22524

Re: TSQLMonitor not supported on Delphi 10.4 Pro.

You can set up DBXTrace for Driver.DelegateConnection in TSQLConnection, and set up TraceFile's file path (required).

After this setting is completed, TSQLMonitor will take effect.

P.S. : If you set TraceDriver to True, an AccessViolation error message will pop up.

See also
http://docwiki.embarcadero.com/RADStudi ... _tutorial)
by Eden0928
Wed 28 Apr 2021 07:05
Forum: dbExpress driver for SQL Server
Topic: Could dbexpsda40.dll not exist in Deployment?
Replies: 3
Views: 21056

Could dbexpsda40.dll not exist in Deployment?

I learned in the "Deployment" chapter of the "README" file:
Users of dbExpress driver for SQL Server with Source Code can embed the driver into the application directly. For information on how to do this refer to Borland documentation
.

This sentence means that if I have purchased the SOURCE version, I don’t need to bring "dbexpsda40.dll" when I publish it?

There is no "Borland Documentation" now. Is there more information for reference?
by Eden0928
Sun 21 Feb 2021 00:48
Forum: dbExpress driver for SQLite
Topic: dbExpress driver for SQLite supports android?
Replies: 1
Views: 17072

dbExpress driver for SQLite supports android?

dbExpress driver for SQLite supports android?

Have doc like :
http://docwiki.embarcadero.com/RADStudi ... d_Android)
by Eden0928
Thu 05 Mar 2020 02:33
Forum: dbExpress driver for SQL Server
Topic: TDBXCommand.IsPrepared property always False
Replies: 1
Views: 6782

TDBXCommand.IsPrepared property always False

Hello, I try the SQL Server driver for dbexpress v8.1.3, code is below:

Code: Select all

const DEVART_MSSQL_CONNECTION_STRING = ''
  +'%s=DevartSQLServer;%s=%s;%s=%s;%s=%s;%s=%s'
  +';BlobSize=-1;SchemaOverride=%%.dbo;LongStrings=True;EnableBCD=True'
  +';FetchAll=True;UseUnicode=True;IPVersion=IPv4';

procedure TForm1.Button1Click(Sender: TObject);
var
  cn: TDBXConnection;
  FConnectionProps: TDBXProperties;
  FConnectionFactory: TDBXConnectionFactory;
  cmd: TDBXCommand;
  rer: TDBXReader;
begin
  FConnectionProps := TDBXProperties.Create;
  FConnectionProps.SetProperties(Format(DEVART_MSSQL_CONNECTION_STRING,
                        [TDBXPropertyNames.DriverName,
                         TDBXPropertyNames.HostName, 'localhost',
                         TDBXPropertyNames.Database, 'ADBDEMOS',
                         TDBXPropertyNames.UserName, 'sa',
                         TDBXPropertyNames.Password, 'saps']));
  FConnectionFactory := TDBXConnectionFactory.GetConnectionFactory;
  cn := FConnectionFactory.GetConnection(FConnectionProps);
  cmd := cn.CreateCommand;
  cmd.Text := 'SELECT * FROM employee where empno=:empno';
  cmd.Prepare;
  if cmd.Parameters.Count > 0 then
  begin
    if cmd.IsPrepared then
    begin
      rer := cmd.ExecuteQuery;
      if rer.Next then
        Caption := rer.Values[0].AsString;
      rer.Free;
    end;
  end;
  cmd.Free;
end;
After TDBXCommand.Prepare method, the TDBXCommand.IsPrepared property should Ture.
However I get the False.

Should I how to do?
by Eden0928
Tue 25 Feb 2020 07:05
Forum: dbExpress driver for SQL Server
Topic: Driver can not set up the TDBXCommon.Parameters
Replies: 6
Views: 23273

Re: Driver can not set up the TDBXCommon.Parameters

Stellar wrote: Mon 24 Feb 2020 16:00 Please use the syntax :<name> to place a parameter marker in a SQL statement when using Devart dbExpress driver for SQL Server. For example:

Code: Select all

procedure TForm2.Button1Click(Sender: TObject);
var
  LCommand: TDBXCommand;
begin
  LCommand := SQLConnection1.DBXConnection.CreateCommand;
  LCommand.Text := 'SELECT * FROM employee WHERE empno = :p1';
  LCommand.Prepare;
  Memo1.Lines.Add(IntToStr(LCommand.Parameters.Count));
end;
Good!
After use Prepare method, TDBXCommand.Parameters.Count > 0.

However, why TDBXCommand.IsPrepared always is False?