Mailing List Archive



Back to the month index Back to the list index

bonsai@net5.co.jp
Tue, 10 Sep 1996 12:18:30 +0900 (JST)


Date: Tue, 10 Sep 1996 12:18:30 +0900 (JST)
From: bonsai@net5.co.jp
Message-Id: <199609100318.MAA16668@sun1.net5.co.jp>
Subject: Re: [mSQL] mSQL/Java Query Exception

Thanks to everyone who answered my query. I was suprised to recieve around 10
replies that all suggested the same, incorrect solution.

Solution, enclose the data contained in each variable in single quotes :

nameval = "'"+name.getText()+"'";
emailval = "'"+email.getText()+"'";

Then build a query string as such :

msql.Query("insert into cdiusers (name, email)
                values ("+nameval+","+emailval+")");

Which when unraveled gives the string :

insert into cdiusers (name, email) values ('whatever name was entered','whatever
email address was entered')

It seems like we all knew what had to be done, but weren't to sure on how to do it.

   Byron (a.k.a Bonsai)
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!