Announcement

Collapse
No announcement yet.

MS SQL server access with PowerBasic?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MS SQL server access with PowerBasic?

    Is it possible with PowerBasic to:

    List MSSQL servers;
    Access a MSSQL server;
    Create a DataBase;
    Create a Table;
    Read and Write data;

    Does PowerBasic works with SQLDMO?

    Thanks

  • #2
    For sure its possible if there is an ODBC datasource for each server. (Create database will be MSSQL-specific, but all the other stuff is 'generic' to ODBC)

    There's probably a COM-based way, too.

    I didn't have a clue what 'SQLDMO' was, so I "googled" for it. It appears to be a documented Microsoft thing, but it is COM-related so I don't know squat about it.
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      PB & SQL Server

      @Virginio,

      try this - it's a real fast connection of PB and MS SQL:

      http://www.powerbasic.com/products/sqltools/

      bye,
      Volker
      www.zentrader.de (Trading system development and simulation tools)

      Comment


      • #4
        When upgrading the old PowerBASIC ubb forums to the new vBulletin forums, the upgrade scripts vBulletin provided where not very good. I cannot blame vBulletin as the old ubb forums where in a very old format. I created a PBCC and SQL Tools application to read the old forums and create the MySQL tables with the necessary information. As you can see it did (not a 100%) a pretty good job - which was my fault and not SQL Tools.

        You can certainly use the ODBC API but that is a pain and I highly recommend PerfectSync's SQL Tools.
        Sincerely,

        Steve Rossell
        PowerBASIC Staff

        Comment


        • #5
          I'd recommend SQLTools as well.

          Comment


          • #6
            In my experience SQL Tools was easier to develop than the sdk odbc api and virtually no difference in speed. I didn't find anything you couldn't do with SQL Tools.

            Bob Mechler

            Comment


            • #7
              Originally posted by Michael Mattias View Post
              There's probably a COM-based way, too.
              Yepp, that way would be through ADO.

              Virgino, search this forum for ADO and you'll find examples how to interface to ADO from PB.

              Comment


              • #8
                Here is a link to code I posted about a year ago...

                http://www.powerbasic.com/support/pb...server+express

                It contains a demo that attempts to connect either to MSDE or SQL Server. If it manages to connect it creates a simple database on the SQL Server and then creates a table within the database containing a few sample fields. Then it reads a few records into and out of the database and displays the info in a console window. It is a Console Compiler program. If you don't have the Console Compiuler I'd recommend converting all the Print statements to Print #FileNum, using an output text file.

                The program was tested on several of my computers and works without fail, but nontheless I can't guarantee it will work for you. If it does or doesn't I'd appreciate hearing about it.

                The program uses direct ODBC function calls with a minimum of wrappers to take the 'edge' off them. For most folks ADO or SQL Tools would probably be a better ottion. I've used ADO with SQL Server too and that works fine.
                Fred
                "fharris"+Chr$(64)+"evenlink"+Chr$(46)+"com"

                Comment


                • #9
                  Originally posted by Virginio Reis View Post
                  Is it possible with PowerBasic to:

                  List MSSQL servers;
                  Access a MSSQL server;
                  Create a DataBase;
                  Create a Table;
                  Read and Write data;

                  Does PowerBasic works with SQLDMO?

                  Thanks
                  List MSSQL servers;
                  Access a MSSQL server;

                  I yet do not know it

                  Create a DataBase;
                  Create a Table;
                  Read and Write data;

                  I do it by means of Microsoft Jet OLE DB-Provider (ADO) - no problem

                  some examples:
                  http://www.powerbasic.com/support/pb...29&postcount=1
                  http://www.powerbasic.com/support/pb...10&postcount=2
                  http://www.powerbasic.com/support/pb...21&postcount=2
                  Last edited by Alexander Holzer; 13 Mar 2008, 02:41 PM.
                  Yours sincerely

                  Comment


                  • #10
                    Thnk You all. Still learning...

                    Comment


                    • #11
                      Originally posted by Virginio Reis View Post
                      Is it possible with PowerBasic to:

                      List MSSQL servers;
                      Access a MSSQL server;
                      Create a DataBase;
                      Create a Table;
                      Read and Write data;

                      Does PowerBasic works with SQLDMO?

                      Thanks
                      Virginio, you can use OBDC function SQLBrowseConnect to list servers, connect to server and list databases:

                      '\\ Setup DB Connect String
                      sInput = "DRIVER={SQL Server}"

                      '\\ Get Result Buffer size and create buffer
                      lRet = SQLBrowseConnect(BYVAL hdbc, sInput,%SQL_NTS, BYVAL STRPTR(sServerList), BYVAL LEN(sServerList) , pResultLen)
                      sServerList = SPACE$(pResultLen)

                      '\\ Call again with correct buffer size.
                      lRet = SQLBrowseConnect(BYVAL hdbc, sInput, %SQL_NTS, BYVAL STRPTR(sServerList), BYVAL LEN(sServerList) , pResultLen)

                      sServerlist will now contain a list of servers found.

                      as you can see its a multiple call function, after the above you can call again for authentication then again to list databases etc.

                      Search for SQL32.INC and SQLEXT32.INC on here.

                      N.

                      Comment


                      • #12
                        Does PowerBasic works with SQLDMO?
                        See some examples here: http://www.powerbasic.com/support/pb...ghlight=sqldmo
                        Forum: http://www.jose.it-berater.org/smfforum/index.php

                        Comment

                        Working...
                        X