ODBC on Access db

Q&A's, tips, howto's
Post Reply
DavMin
Posts: 16
Joined: Fri Dec 09, 2011 8:07 pm

ODBC on Access db

Post by DavMin »

Code: Select all

(set 'sourcedir (append (env "USERPROFILE") "\\Desktop\\Newlisp Access"))
(load (append sourcedir "\\odbc.lsp"))

(if (not (ODBC:connect (append sourcedir "\\fake.accdb") "" "")) (println "not connected..")
(println "connected.."))
Output:

Code: Select all

"C:\\Documents and Settings\\dm\\Desktop\\Newlisp Access" (lambda ()   (if (not (ODBC:connect "test-db" "" ""))    (exit))   (println "connected ...")   (ODBC:query "insert into fruits values ('apples', 11)")   (ODBC:query "insert into fruits values ('oranges', 22)")   (ODBC:query "insert into fruits values ('bananas', 33)")   (println "inserted 3 records")   (ODBC:query "select * from fruits")   (println "performed a query")   (println (ODBC:num-cols) " columns in result set")   (println "fetching rows ...")   (while (set 'row (ODBC:fetch-row))    (set 'row (map trim row))    (println row))   (println)   (ODBC:query "delete from fruits")   (println "rows deleted: " (ODBC:affected-rows))   (println "\nclosing database")   (ODBC:close-db)) Could not connect not connected.. "not connected.."
What have I done wrong? Thanks.

Post Reply