[erlang-questions] database retrieve problem

Bob Ippolito bob@REDACTED
Sun Mar 28 18:57:20 CEST 2010


Take a closer look at the documentation for odbc:sql_query/2 and what
its expected return value is for a non-batched query.

On Sun, Mar 28, 2010 at 9:37 AM, NavaTux <navaneethanit@REDACTED> wrote:
> I wanna to use the query to retrieve some results from the database,so
> i used these lines
>
> event(continue) ->
>        [Name] = wf:q(no_id),
>        Message = wf:f("The Result is~p", [Name]),
>        ConnString = "DSN=mysqldb",
>        {ok, Conn} = odbc:connect(ConnString, []),
>        [Results] = odbc:sql_query(Conn, "SELECT * FROM marks where id=1"),
>        io:format("~p",[Results]),
>        wf:flash([Results]),
>  ok;
> event(_) -> ok.
>
> but i am unable to get the output,Here continue is the postback for
> button,here what goes wrong?
>
> I am getting output in my terminal is
>
>
> =INFO REPORT==== 28-Mar-2010::21:56:22 ===
> ERROR: error
> {badmatch,{selected,["id","tamil","english","maths","science"],
>                    [{1,45,55,67,89}]}}
> [{web_index,event,1},
>  {wf_handle_postback,run_module_event,2},
>  {wf_handle_postback,handle_normal_request,3},
>  {wf_inets,do,3},
>  {httpd_response,traverse_modules,2},
>  {httpd_response,generate_and_send_response,1},
>  {httpd_request_handler,handle_response,1},
>  {gen_server,handle_msg,5}]
>
>
> id,tamil,english,maths,science are database fields....
>
> please help me
> as well as i wanna know how to flash the output that i retrieved from
> the database in my webpage..
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>


More information about the erlang-questions mailing list