Page 1 of 1

ODBC on Access db

Posted: Fri Dec 16, 2011 4:57 pm
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.."))

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.