ODBC on Access db

Q&A's, tips, howto's

ODBC on Access db

Postby DavMin » Fri Dec 16, 2011 4:57 pm

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.
DavMin
 
Posts: 16
Joined: Fri Dec 09, 2011 8:07 pm

Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest

cron