Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. database access,extracting result... (Damien Mattei) ---------------------------------------------------------------------- Message: 1 Date: Mon, 3 Dec 2018 12:21:54 +0100 From: Damien Mattei <mat...@oca.eu> To: beginners@haskell.org Subject: [Haskell-beginners] database access,extracting result... Message-ID: <5c0511d2.6030...@oca.eu> Content-Type: text/plain; charset=utf-8 {-# LANGUAGE OverloadedStrings #-} import Database.MySQL.Simple import Control.Monad import Data.Text as Text import Data.Int main :: IO () main = do conn <- connect defaultConnectInfo { connectHost = "moita", connectUser = "mattei", connectPassword = "******", connectDatabase = "sidonie" } rows <- query_ conn "select `N° BD` from sidonie.Coordonnées where Nom = 'A 20'" --putStrLn $ show rows forM_ rows $ \(fname, lname) -> putStrLn $ fname ++ " " ++ Text.unpack lname ++ " " here is the error: *Main> :load Toto [1 of 1] Compiling Main ( Toto.hs, interpreted ) Ok, one module loaded. *Main> main *** Exception: ConversionFailed {errSQLType = "1 values: [(VarString,Just \"-04.3982\")]", errHaskellType = "2 slots in target type", errFieldName = "[\"N\\194\\176 BD\"]", errMessage = "mismatch between number of columns to convert and number in target type"} -04.3982 is the values i want to put in a variable,it's the N° BD (Durchmusterung Number) ??? any help greatly appeciated ;-) -- damien.mat...@unice.fr, damien.mat...@oca.eu, UNS / OCA / CNRS ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 126, Issue 1 *****************************************