[Haskell-beginners] Sqlite3 - INSERT statement question
kmandpjlynch at verizon.net
Thu Feb 3 18:20:12 CET 2011
I'm using "Real World Haskell" and a Windows Vista PC and I have Sqlite3 installed...[note: I had to change test1.db to /users/user/test1.db in order to get this to work, otherwise, neither the database nor the table could be created -- also, note c:/users/user/test1.db gives a syntax error], ghci doesn't like c:/]:
I tried to use the following example from the book but it failed...see following:
Prelude> :m Database.HDBC Database.HDBC.Sqlite3
Prelude Database.HDBC Database.HDBC.Sqlite3> conn <- connectSqlite3 "/users/user/test1.db"
Prelude Database.HDBC Database.HDBC.Sqlite3> run conn "INSERT INTO test VALUES (?, ?)" [toSql 0, toSql "zero"]
No instance for (Data.Convertible.Base.Convertible t SqlValue)
arising from a use of `toSql' at <interactive>:1:43-49
add an instance declaration for
(Data.Convertible.Base.Convertible t SqlValue)
In the expression: toSql 0
In the third argument of `run', namely `[toSql 0, toSql "zero"]'
In the expression:
run conn "INSERT INTO test VALUES (?, ?)" [toSql 0, toSql "zero"]
I'd appreciate any advice...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners