Free dll to work with Access database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Peyman
    New Member
    • Nov 2006
    • 38

    #46
    Sorry Dermot

    Your new DLL have problem please see the Attachment picture:

    I found problem. you can insert the below code after DLL.CallFunction :

    Code:
    result = String.Replace(result, ";;", ";", false);
    result = String.Replace(result, "||", "|", false);
    Attached Files

    Comment

    • lnd
      Indigo Rose Customer
      • Oct 2005
      • 631

      #47
      2 questions

      1. can i create a database whit a password ???
      2. can i delete a table whit all the data inside ???

      Comment

      • Dermot
        Indigo Rose Customer
        • Apr 2004
        • 1791

        #48
        Originally posted by Peyman View Post
        Your new DLL have problem please see the Attachment picture:

        I found problem. you can insert the below code after DLL.CallFunction :

        Code:
        result = String.Replace(result, ";;", ";", false);
        result = String.Replace(result, "||", "|", false);
        If you are using the new dll with the old sample app then it won't work. The delimeters changed so you need to update any call to the DelimitedStringToTable function.
        Dermot

        I am so out of here :yes

        Comment

        • Dermot
          Indigo Rose Customer
          • Apr 2004
          • 1791

          #49
          Originally posted by lnd View Post
          1. can i create a database whit a password ???
          2. can i delete a table whit all the data inside ???
          Don't know about creating a database with a password. Don't think so.

          To delete a table use DROP Table TableName
          Dermot

          I am so out of here :yes

          Comment

          • Desolator
            Forum Member
            • Apr 2007
            • 292

            #50
            I put a few functions in a LUA file to use with this. However, currently you can't create a password-protected xMDB.

            Anyway, call them like this:
            xMDB.CreateDB(xMDBdb, xMDBPassword);
            xMDB.Query(xMDBdb, xMDBQuery, xMDBPassword);
            xMDB.QueryToTable(xMDBdb, xMDBQuery, xMDBPassword);

            As the forum won't let me upload .lua files, don't forget to rename xMDB.txt to xMDB.lua, but it doesn't really matter.
            Attached Files

            Comment

            • lnd
              Indigo Rose Customer
              • Oct 2005
              • 631

              #51
              how can i edit data??? (not delete or insert)

              how can i edit data??? (not delete or insert).
              if i insert a new data the data add to a new line in the database file and i need to edit the data in the his line i dont wont a new line.

              Comment

              • lnd
                Indigo Rose Customer
                • Oct 2005
                • 631

                #52
                can i Update specific line??

                can i Update specific line??
                if i wont to Update line 6 in the databse can i do it???

                Comment

                • bule
                  Indigo Rose Customer
                  • May 2005
                  • 1116

                  #53
                  You do not update rows in SQL by line, but instead using WHERE clause. If your desired line has a unique id 6, then add WHERE id=6 to the query.
                  Never know what life is gonna throw at you. ZubTech

                  Comment

                  • lnd
                    Indigo Rose Customer
                    • Oct 2005
                    • 631

                    #54
                    i dont understand.

                    in my database 10 lines and i wont to edit a line. how can i do it???
                    i know how to reading the line and change the data in AMS and delete the line from the database and insert the new line. but its very not smart.

                    Comment

                    • bule
                      Indigo Rose Customer
                      • May 2005
                      • 1116

                      #55
                      You do not have lines in your database.
                      Instead, you have tables in your database.
                      In these tables you have columns and records.
                      Columns and Records are not returned in any particular order,
                      as it all depends on the database fragmantation.

                      To overcome this, most people add a special column in every table
                      called id and make it unique for every record. This way, if they
                      want to change some record, they refer to it using WHERE clause
                      and specifing constraint in a form like id=6.

                      Table mytable before:
                      id | name | position | color
                      ----------------------------------
                      1 mark second white
                      2 tom tenth black
                      6 bulle third yellow

                      UPDATE mytable SET name='bule', color='blue' WHERE id=6;

                      Table mytable after:
                      id | name | position | color
                      ----------------------------------
                      1 mark second white
                      2 tom tenth black
                      6 bule third blue
                      Last edited by bule; 05-27-2007, 09:16 AM.
                      Never know what life is gonna throw at you. ZubTech

                      Comment

                      • lnd
                        Indigo Rose Customer
                        • Oct 2005
                        • 631

                        #56
                        this code update the table not the database

                        this code update the table not the database

                        Comment

                        • bule
                          Indigo Rose Customer
                          • May 2005
                          • 1116

                          #57
                          Originally posted by bule View Post
                          UPDATE mytable SET name='bule', color='blue' WHERE id=6;
                          ...................
                          Never know what life is gonna throw at you. ZubTech

                          Comment

                          • Dermot
                            Indigo Rose Customer
                            • Apr 2004
                            • 1791

                            #58
                            Originally posted by lnd View Post
                            this code update the table not the database
                            The table is in the database so it is updated also. I strongly suggest that before you try using this that you learn at least the basics about databases and SQL.
                            Dermot

                            I am so out of here :yes

                            Comment

                            • lnd
                              Indigo Rose Customer
                              • Oct 2005
                              • 631

                              #59
                              sorry but i get an erorre

                              the code
                              the error is in the UPDATE

                              Query = "SELECT * FROM HELP";
                              if Query ~= "" then
                              result = DLL.CallFunction(_SourceFolder.."\\AutoPlay\\Docs\ \xMDB.dll", "Query_Select_MDB", "\""..DB.."\",\""..Query.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
                              if String.Left(result, 5) ~= "Error" then
                              if result ~= "NO_DATA" then
                              tbl = DelimitedStringToTable(result, "|")
                              end
                              end
                              end



                              Query = "UPDATE tbl SET HELPME='1', USERID='123' WHERE NUMBERQ=3";


                              result = DLL.CallFunction("AutoPlay\\Docs\\xMDB.dll", "Query_Update_MDB", "\""..DB.."\",\""..Query.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)

                              if result == "OK" then
                              Dialog.Message("Success", "Record added.", MB_OK, MB_ICONINFORMATION)
                              else
                              Dialog.Message("Failed", result, MB_OK, MB_ICONEXCLAMATION)
                              end

                              Comment

                              • Dermot
                                Indigo Rose Customer
                                • Apr 2004
                                • 1791

                                #60
                                You are trying to update the Lua table created from the result of the select query. You need to update the table in the database.

                                Code:
                                Query = "UPDATE [COLOR="Red"]HELP[/COLOR] SET HELPME='1', USERID='123' WHERE NUMBERQ=3";
                                Dermot

                                I am so out of here :yes

                                Comment

                                Working...
                                X