Bug in passing numerical values to DB?
"INSERT INTO CUSTOMER (ACCOUNT) VALUES (value( "Counter" ))" does not work - sysntax error. I am trying to pass a value from the counter to a DB. My counter generates account numbers when new customer signs in. Maybe there is a better way to store account numbers in DB?
Bug in passing numerical values to DB?
"INSERT INTO CUSTOMER (ACCOUNT) VALUES (value( "Counter" ))" does not work - sysntax error. I am trying to pass a value from the counter to a DB. My counter generates account numbers when new customer signs in. Maybe there is a better way to store account numbers in DB?
Re: Bug in passing numerical values to DB?
"syntax error" means your expression is malformed, as we observed above. You made the same mistake you did before.
"INSERT INTO CUSTOMER (ACCOUNT) VALUES" is a literal string, in double quotes, while value( "Counter" ) is an MMF expression, so it *must not* be in double quotes. Also, you need to convert the MMF number into an MMF string. in other words:
"INSERT INTO CUSTOMER (ACCOUNT) VALUES " + str$(value( "Counter" )))
Re: Bug in passing numerical values to DB?
"syntax error" means your expression is malformed, as we observed above. You made the same mistake you did before.
"INSERT INTO CUSTOMER (ACCOUNT) VALUES" is a literal string, in double quotes, while value( "Counter" ) is an MMF expression, so it *must not* be in double quotes. Also, you need to convert the MMF number into an MMF string. in other words:
"INSERT INTO CUSTOMER (ACCOUNT) VALUES " + str$(value( "Counter" )))
Re: Bug in passing numerical values to DB?
nice try...:).....you have extra ")" at the end - here comes SYNTAX ERROR. but even after it removed - still no data goes to DB. and, YES, I do have a communication between MMF and DB.
Re: Bug in passing numerical values to DB?
nice try...:).....you have extra ")" at the end - here comes SYNTAX ERROR. but even after it removed - still no data goes to DB. and, YES, I do have a communication between MMF and DB.
Re: Bug in passing numerical values to DB?
"INSERT INTO CUSTOMER (ACCOUNT) VALUES ("+str$(value( "Counter" ))+")"
Keep in mind that you have to create a string, you could easily test expressions by displaying them in any text object. The strings have to be in single quotes most of the time (depending on the database, but it's always better to use them)
Re: Bug in passing numerical values to DB?
"INSERT INTO CUSTOMER (ACCOUNT) VALUES ("+str$(value( "Counter" ))+")"
Keep in mind that you have to create a string, you could easily test expressions by displaying them in any text object. The strings have to be in single quotes most of the time (depending on the database, but it's always better to use them)
Re: Bug in passing numerical values to DB?
Corentin, you are now officially my HERO!...your suggestion helped. Thanks a lot.
Re: Bug in passing numerical values to DB?
Corentin, you are now officially my HERO!...your suggestion helped. Thanks a lot.
Re: Bug in passing numerical values to DB?
Glad I helped in some way <img src="/center/images/graemlins/laugh.gif" alt="" />
You can probably find many SQL tutorials on the net (the ones I know are in french, sorry), but feel free to ask if you need help.
Re: Bug in passing numerical values to DB?
Glad I helped in some way <img src="/center/images/graemlins/laugh.gif" alt="" />
You can probably find many SQL tutorials on the net (the ones I know are in french, sorry), but feel free to ask if you need help.