Re: Sql statements error by Renaud
Renaud
Sat Aug 23 09:12:47 CDT 2003
On Fri, 22 Aug 2003 12:09:31 +0200, "Julio Villalba"
<julio_villalba@hotmail.com> wrote:
>Thank you very much this really helped me, now some of my statements works
>but others dont, i cant find a good example on doing INNER JOIN, i have been
>programming all my life without using it and now im really getting trouble
>using them now, could you help me one more time???
>SELECT * FROM
>prrutcli
>INNER JOIN prclient
>INNER JOIN prfopago
>ON prrutcli.cliente = prclient.cliente
>ON prclient.fopago=prfopago.fopago
>In the example of the evb help it uses '(' and im trying to put them but its
>not working, and in the SQL help of sql server or in the msdn i cant find a
>good example or just the syntax of the command....
>Thanks again
>
SQL CE supports older style SQL This should also work
Select * From
prrutcli, prclient, prfopago
Where prrutcli.cliente = prclient.cliente
And prclient.fopago=prfopago.fopago
>
>"Jack Lee" <jack@tek-files.com> escribió en el mensaje
>news:31cf38f6.0308211028.70f49d5@posting.google.com...
>> of your 2 statments
>>
>> > >stringSql = "SELECT agente,razon " & _
>> > > "from pragente " & _
>> > > "INNER JOIN prtermin " & _
>> > > "ON pragente.agente=prtermin.agente"
>>
>> this one needs to have the table names in the select or it'll complain
>> about unresolvable fields.
>>
>> stringSql = "SELECT pragente.agente,pragente.razon " & _
>> "from pragente " & _
>> "INNER JOIN prtermin " & _
>> "ON pragente.agente=prtermin.agente"
>>
>> your second statement looks perfectly fine to me.
>> > > stringSql = "Select pragente.agente,prtermin.agente from
>> > > pragente,prtermin where prtermin.agente = pragente.agente"
>>
>>
>> the database should be fine, maybe just make sure you don't have it
>> open already and are trying to open it in a 2nd call. ie) just make
>> sure you do not have a database connection already open when you make
>> your call.
>>
>> also try using adOpenStatic instead of adOpenKeyset
>>
>> recordsetBD.Open stringSql, conexion, adOpenStatic , adLockOptimistic
>>
>> other than that not sure what else to try.
>>
>> jack
>>
>> "Julio Villalba" <julio_villalba@hotmail.com> wrote in message
>> news:<#c95409ZDHA.2548@TK2MSFTNGP09.phx.gbl>...
>> > The error is in spanish, ;), im from spain.
>> > it says:
>> > An error was ecountered while running this program:
>> > The statement contains one or more errors
>> > thats it, nathing more....
>> > could you show me how do you access data from 2 or more tables in a sql
>> > statement that the cdb database can understand? because i have tried
>> > everything and i got to the same point everytime...should i do something
>to
>> > the database???i mean i have it in access 2002 and and import it to the
>pda
>> > with the active sync utility....
>> > thank you i hope you can help me.
>> > "Jack Lee" <jack@tek-files.com> escribió en el mensaje
>> > news:31cf38f6.0308201148.15930ad@posting.google.com...
>> > > what error are you getting? have you tried the statement with query
>> > > analyzer on the pocket pc to see if that gives a more descriptive
>> > > error?
>> > >
>> > > i open my recordsets the same way but not as a global variable. since
>> > > sql ce only supports one connection at a time, i open it , do my stuff
>> > > and close it ASAP.
>> > >
>> > > jack
>> > >
>> > > "Julio Villalba" <julio_villalba@hotmail.com> wrote in message
>> > news:<uytGlUuZDHA.2620@TK2MSFTNGP09.phx.gbl>...
>> > > > Hi im developing an application in evb and im having problems
>accessing
>> > the
>> > > > database. everytime i try to send a sql query to the database that
>> > contains
>> > > > fields from more than two tables i got an error saying that there is
>> > some
>> > > > errors in the statement. This query string i have try it against an
>> > access
>> > > > database in my pc and it works but when i try it in the pda against
>a
>> > cdb i
>> > > > got errors.
>> > > > I try this two statements and both got errors in the pda:
>> > > > stringSql = "SELECT agente,razon " & _
>> > > > "from pragente " & _
>> > > > "INNER JOIN prtermin " & _
>> > > > "ON pragente.agente=prtermin.agente"
>> > > > and
>> > > > stringSql = "Select pragente.agente,prtermin.agente from
>> > > > pragente,prtermin where prtermin.agente = pragente.agente"
>> > > > also i want some advice in the design of my application i have a
>> > function
>> > > > that queries the db that has this statement
>> > > > recordsetBD.Open stringSql, conexion, adOpenKeyset, adLockOptimistic
>> > > > the recordsetbd is a global variable and i have to close it after
>read
>> > it,
>> > > > is there any way to do it in a better way?, for the inserts i do an
>> > execute
>> > > > command of the connection variable.
>> > > > Thanks, i really apreciate your help.
>> > > >
>> > > > Julio Villalba
>> > > > MCP-CCNA-CLS
>