Recent

Author Topic: Updated March_6 Source Code Project for database dev., using Lazarus with SQLdb  (Read 47131 times)

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
I'd like to contribute this code to all newbie of Lazarus Database development.

Sample Source code project(.lpr) includes;
(source code at the bottom of the page)

SQLITE
(updated2_with_add_delete_update)
http://wiki.lazarus.freepascal.org/User:Rocarobin

MSACCESS
(updated2_with_add_delete_update)
http://wiki.lazarus.freepascal.org/MS_Access

MYSQL with (update delete add) using TMySQLConnection
http://www.mediafire.com/file/o521t68uc1k6559/mysqltest1.zip



This source code project files are working on the fly, you can put to any folder or directory you wanted too. :D
Oh, sorry about the mysqltest, it can't fly, just create a database and table to test it, or just see the code on how does it flow. :D


Working on it....(please comment or REQUEST,REQUEST,REQUEST, reply)
SQLdb using Interbase/Firebird
SQLdb using MSSQL

Thanks
« Last Edit: March 06, 2011, 10:21:17 am by xenablaise »

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #1 on: October 17, 2010, 09:24:43 am »
http://wiki.lazarus.freepascal.org/User:Rocarobin

You can find the source code attached at the bottom.


Happy coding Lazarus :D

Oh, with that small database application, I've earned 100box
« Last Edit: October 18, 2010, 02:33:42 am by xenablaise »

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #2 on: October 17, 2010, 02:41:13 pm »
Tell everyone about Lazarus, like they did in Java(which is far). :D
« Last Edit: October 18, 2010, 02:32:27 am by xenablaise »

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #3 on: October 17, 2010, 02:50:39 pm »
if you think the way I code is different and lack of professionalism or my code-way is bad, please do comment, I'm glad to hear it.

And if you think it helped you guiding your way building a good database system, please let me know, so I can further continue to distribute another work for Lazarus.


Thank you,

Just a Lazarus newbie also.

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #4 on: October 18, 2010, 01:43:21 am »
Please comment ;)

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #5 on: October 18, 2010, 07:07:35 am »
Thansk for the information.

BlueIcaro

  • Hero Member
  • *****
  • Posts: 818
    • Blog personal
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #6 on: October 18, 2010, 09:09:49 am »
Why don't you add this information to the wiki?

/BlueICaro

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #7 on: October 18, 2010, 10:04:16 am »
hi

Quote
Why don't you add this information to the wiki?
About what?

FILEDSN?
or
this one?
http://wiki.lazarus.freepascal.org/User:Rocarobin



Thank you
« Last Edit: October 18, 2010, 10:13:29 am by xenablaise »

BlueIcaro

  • Hero Member
  • *****
  • Posts: 818
    • Blog personal
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #8 on: October 18, 2010, 10:15:27 am »
hi

Quote
Why don't you add this information to the wiki?
About what?

FILEDSN?
or
this one?
http://wiki.lazarus.freepascal.org/User:Rocarobin

OH! nice, I'll bookmark it, on my favorites

/BLueIcaro



Thank you

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #9 on: October 18, 2010, 10:29:13 am »
A source code at the bottom of the page.
Using SQLdbS with SQLITEConnection

I'll make other SQL connection upon request.
Maybe an hour I'll upload using TODBCConnection using FILEDSN which is safe on fly.

And I don't know how to create a lazarus wiki, can you give me a hint.

Do you mean about filedsn and the source code?
I can include the ms_access code.


Thanks.

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Re: Contribution of Database development for Lazarus using SQLdb
« Reply #10 on: October 18, 2010, 04:33:23 pm »
Accessing Ms_Access:
http://wiki.lazarus.freepascal.org/MS_Access
 :D

Working Source code sample project:(at the bottom of the page)


Enjoy Lazarus
« Last Edit: October 19, 2010, 01:16:28 am by xenablaise »

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Video tururials from
Quote
tkramer3
using Lazarus IDE with LazReport.
 :D
http://www.youtube.com/watch?v=pq2oCiJePHo
http://www.youtube.com/watch?v=ewNjqFXqDDc
http://www.youtube.com/watch?v=urEdbyV_AbE

Nice videos.
GO and tell the others about Lazarus.


tkramer3?
Thanks for sharing.

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Anyone else wants to contribute?
or
anyone requesting another sample?
or
someone wants another database connection?

project source code are update oct 21 2010
msaccess with add delete update print
sqlite with add_delete_update_print_MASTER_and_Detail_DBGrids

scroll at the top :D


tell everyone about Lazarus 8-)

xenblaise

  • Sr. Member
  • ****
  • Posts: 358
Quote
if you dont want to use datamodule or the component
try something like that;

why use datamodules while you can directly call them
just like in vb6

sdb := TSQLQuery.Create(nil);
cndb := TODBCConnection.Create(nil);
stran := TSQLTransaction.Create(nil);

stran.DataBase := cndb;
stran.Action := caCommit;
stran.Active := True;

cndb.Transaction := stran;
cndb.Open;

rsdb.DataBase := cndb;
rsdb.SQL.Text := 'SELECT * FROM Table1';
rsdb.Open;


Quote
my another sample



  TDBClass = class
  private

    // a data set to mantain all templates of database
    dsQuery: TSQLQuery;

    // the connection object
    mycon: TMYSQL40Connection;

    // SQL Transaction
    SQLTransact: TSQLTransaction;

  public
    function openDB(): boolean;
    procedure closeDB();
    procedure clearDB();

  end;

implementation
...
...
...

// TdbClass Usage
// Open connection
function TDBClass.openDB(): boolean;
begin
  try
        dsQuery := TSQLQuery.Create(nil);
        mycon := TMySQL40Connection.Create(nil);
        SQLTransact := TSQLTransaction.Create(nil);

        mycon.UserName := 'root';
        mycon.HostName := 'localhost';
        mycon.port := 3306;
        mycon.DatabaseName := 'XXX';

        SQLTransact.DataBase := mycon;
        SQLTransact.Action := caCommit;
        SQLTransact.Active := True;

        dsQuery.DataBase := mycon;

        mycon.Transaction := SQLTransact;
        mycon.Open;

       openDB := true;
  except
        openDB := false;
  end;
end;
 :D

thierrybo

  • Full Member
  • ***
  • Posts: 143
I downloaded msaccesstest2.zip from the wiki and get :

Transaction already active, press OK to ignore and risk data corruption.

Then I get the main form with no data. Compiled with Lazarus 0.9.29 r27163 FPC 2.4.3 i386-win32-win32/win64 (Windows XP SP3)

I get the same error with Windows 7.

Thierry B.

 

TinyPortal © 2005-2018