Run-Time DataSnap can not Append / Edit

Help
Anonymous
2011-11-28
2013-05-01
  • Anonymous - 2011-11-28

    In below sample code:
    var
      sq : TSQLQuery;
      dsp: TDataSetProvider;
      cds: TClientDataSet;
    begin
      DM.cn := TSQLConnection.Create(nil);
      sq := TSQLQuery.Create(nil);
      sq.SQL.Text := 'SELECT * FROM a ';
      dsp:= TDataSetProvider.Create(sq);
      dsp.Name := 'dspName';
      cds:= TClientDataSet.Create(sq); 
      cds.ProviderName := dsp.Name;
      cds.Open;
     
      cds.Append;
      cds.Fields.Field.AsString := 'Zoo';
      cds.Post;
     
      cds.ApplyUpdate(0);

      FreeAndNil(cds);
      FreeAndNil(dsp);
      FreeAndNil(sq);
    end;

    But, each UpdateCount = "0" !   Why???

     
  • Anonymous - 2011-11-28

    Add + Modify My sample code:
      cn.param…………
    .
    .
    .
    cn.Active := True;
      sq.SQLConnection := DM.cn
      dsp:= TDataSetProvider.Create(sq);
      dsp.DataSet := sq;
      dsp.Name := 'dspName';

    if I used Borland DBX Driver to Firebird, Sample code is OK.

    But open-dbexpress can not…

    I used Delphi 7 + SQL Server 2008

     
  • Anonymous - 2011-11-28

    Replenish:
    No any log when ApplyUpdate(0) in SQL Server Profiler.

     
  • Vadim V.Lopushanskiy

    What is your version of Delphi?
    Do you have a table Primary Key?
    Try the debug version dbxoodbc \ driver \ binary \ debug \ dbxoodbc.dll
    When the application is run from the IDE, see the log on IDE sheet "Event Log. When the application runs independently use the" dbgview.exe ".

    If the driver is built into your application (uses DbxOpenOdbcStatic), then
    for getting log need compile an application with the option _DEBUG_.

     
  • Anonymous - 2011-11-29

    dbgview.exe have show message:
      ModuleSDK::XM_ExecuteCommand() Error!!, status: 0xe000000f

    I don't know _DEBUG_ where to set…

     
  • Vadim V.Lopushanskiy

    1)
    IDE/Project/Options/Directories/Conditional Defines: add value _DEBUG_ (or DEBUG;_DEBUG_)

    or

    open file "DbxOpenOdbc.inc" and add line:
    {$DEFINE _DEBUG_}

    2) add to you project modules:

    uses
      DbxOpenOdbcStatic, //{ optional } // statical linking dbxoodbc.dll (dll not required)
      DbxXXDrv, { critical }
      …

        

     
  • Vadim V.Lopushanskiy

    This option (_DEBUG_) slows down the driver. Therefore, in the final version of its need to comment / delete.

     
  • Anonymous - 2011-11-29

    Step1. DbxOpenOdbc.inc add line:
    {$DEFINE _DEBUG_}
    Step 2. uses
      FastMM4,
      DbxOpenOdbcStatic,
      DbxXXDrv…

    Open Event Log
    Run ApplyUpdate(0)…NO ANY LOG
    DebugView is too!

     
  • Vadim V.Lopushanskiy

    If you run the application from the IDE, you need to look at the log tab IDE "Event Log".
    If you do not run from the IDE, you need to log in to watch dbgview.exe

     
  • Anonymous - 2011-11-29

    OK
    Now, I not run the IDE. Execute dbgview.exe.
    In below it's log:

    VCLFixPack patch installed: ControlResizeFix
    VCLFixPack patch installed: ActionListAVFix
    VCLFixPack patch installed: ContextMenuFix
    VCLFixPack patch installed: SysUtilsAbortFix
    VCLFixPack patch installed: MDIChildFocusFix
    VCLFixPack patch installed: PageControlPaintingFix
    VCLFixPack patch installed: GridFlickerFix
    VCLFixPack patch installed: CancelHintDeadlockFix
    Microsoft Excel On Connection
    ConnectMode = 1
    Custom(1) = 3
    App Version = 11.0
    gbIsValidLangSetting = True
    gbBootLoad = True
    Microsoft Excel On AddInsUpdate
    Microsoft Excel On StartupComplete
    Microsoft Excel On BeginShutdown
    Microsoft Excel On Disconnection
    RemoveMode = 0
      ModuleSDK::XM_ExecuteCommand() Error!!, status: 0xe000000f

     
  • Vadim V.Lopushanskiy

    - your dbxoodbc version ?
    - ms msql demos: "dbxoodbc\demos\dbms\mssql\sql\"

    I  do not understand.
    - plase share your sample code.

     
  • Anonymous - 2011-11-29

    1. My dbxoodbc version is dbxoodbc_3_2011_1119dev1.7z
    2. Yes! I used demos-dbx_mssql_connection bind my SQLConnection.
    3. My code:
    procedure TMain.MyFunction(MsExcelWorkSheet:Variant; RowNumber:Integer);
    var
      qy:TSQLQuery;
      dsp:TDataSetProvider;
      cds:TClientDataSet;
      iTemp, iColUseRang, iRowUseRang:Integer;
      sObjNo, sObjNM, sSQLCommand, sSQLCommand1: string;
    begin
      qy := TSQLQuery.Create(nil);
      qy.SQLConnection := DM.cn;
      dsp := TDataSetProvider.Create(qy);
      dsp.Name := 'dspobj';
      dsp.DataSet := qy;
      cds := TClientDataSet.Create(qy);
      cds.ProviderName := dsp.Name;

      iColUseRang := MsExcelWorkSheet.UsedRange.Columns.Count;
      iRowUseRang := MsExcelWorkSheet.UsedRange.Rows.Count;

      qy.SQL.Text := ''
                  +'SELECT * '
                  +'FROM obj ';
      cds.Open;

      for iTemp:=RowNumber to iRowUseRang do
      begin
        sObjNo := Trim(MsExcelWorkSheet.Cells.Item.Value);
        sObjNM := Trim(MsExcelWorkSheet.Cells.Item.Value);
        if (sObjNo = '') then Continue;
        if cds.Locate('objno', sObjNo, ) then
          cds.Edit
        else
          cds.Append;
        cds.Fields.Fields.AsString := sObjNo;
        cds.Fields.Fields.AsString := sObjNM;
        cds.Post;
      end;
      cds.ApplyUpdates(0);
     
      FreeAndNil(cds);
      FreeAndNil(dsp);
      FreeAndNil(qy); 
    end;

     
  • Anonymous - 2011-11-29

    DataModule.OnCreate:
        dbx_mssql_connect.MsSqlConnect(
          cn,
          2008,
          {SERVER=} sHost,
          {DATABASE=} sDatabase,
          {User=} sUserID,
          {Password=} sPassword
        );

     
  • Vadim V.Lopushanskiy

    - demos\mssql\sql contain sheet "Log: SQLMonitor"
    - shows the structure of the table "obj". Does it have Primary Key?

     
  • Anonymous - 2011-11-29

    cds.Fields.Fields.AsString   <- It is Primary Key!

    TSQLMonitor?
    I try it, now…

     
  • Anonymous - 2011-11-29

    ok.
    In below code:
      qy.SQL.Text := ''
                  +'SELECT * '
                  +'FROM obj ';
      cds.Open;
      if SQLMonitor1.Active = False then SQLMonitor1.Active := True;


    cds.ApplyUpdates(0);

    It's no any log!

     
  • Anonymous - 2011-11-29

    Only log…
    ISqlConnection.SetOption ConnCallBackInfo: conn: "$4A7D320"; callback: $460A90; data: $1725670; dbxoodbc: 3.2011.11.19 Beta

     
  • Anonymous - 2011-11-29

    OK
    I re-compile and install open dbexpress.

    Everything in order! 

    OMG!

     
  • Vadim V.Lopushanskiy

    dbxoodbc_3_2011_1129dev1.7z

      dbxoodbc\dev\dbxoodbc\demos\dbms\mssql\sql\Unit1.pas

        see: procedure test_20111129();

    It is work for table tbl_obj.
    You never show your structure of your table "obj".

     
  • Vadim V.Lopushanskiy

    Read the updated file "ReadMe.Txt" (looking DbxOpenOdbc_options.inc)

     
  • Anonymous - 2011-11-30

    Got it!
    Thank you, Pult!

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks