OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[Postgres - ODBC - Windows 2k] Get specific data from DB

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
decoy
General User
General User


Joined: 11 Aug 2003
Posts: 5
Location: Netherlands, Rotterdam

PostPosted: Mon Aug 11, 2003 5:11 am    Post subject: [Postgres - ODBC - Windows 2k] Get specific data from DB Reply with quote

HEllo ppl,

I'm trying to get some specific data from a database so I can auto-create a letter and/or fax.
I have the folowing code.
Code:

   'Gegevens opvragen
   InputVal = InputBox("Nummer:", "Nummer", "")
   
   'Ons Select statement
   Statement = Connection.createStatement()
   ResultSet = Statement.executeQuery("SELECT * FROM public.overzich WHERE overzich.field5 = InputVal LIMIT 1")


the problem lies in:
Code:

("SELECT * FROM public.overzich WHERE overzich.field5 = 'InputVal' LIMIT 1")


SELECT * FROM public.overzich LIMIT 1 ; Works fine, but i want to use the value from the inputbox.

I tried the following but they all failed:
Code:

("SELECT * FROM public.overzich WHERE overzich.field5 = InputVal LIMIT 1")

("SELECT * FROM public.overzich WHERE overzich.field5 = 'InputVal' LIMIT 1")

("SELECT * FROM public.overzich WHERE overzich.field5 = ''InputVal'' LIMIT 1")

("SELECT * FROM public.overzich WHERE overzich.field5 = "InputVal" LIMIT 1")

("SELECT * FROM public.overzich WHERE overzich.field5 = ", InputVal, " LIMIT 1")


Can anyone tell me how to use the variable from the inputbox in the select-statement?

I couldn't find anything with the search or in documents I found on the web.
Back to top
View user's profile Send private message Visit poster's website
decoy
General User
General User


Joined: 11 Aug 2003
Posts: 5
Location: Netherlands, Rotterdam

PostPosted: Tue Aug 12, 2003 1:40 am    Post subject: Reply with quote

OK i've got it now... at last...

Here it is the statment:
Code:

("SELECT * FROM public.overzich WHERE public.overzich.field5 LIKE '" + InputVal + "' LIMIT 1")


or

Code:

("SELECT * FROM public.overzich WHERE public.overzich.field5 = '" + InputVal + "' LIMIT 1")


It's what you want...
Cool
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group