Spot my error

Post

Posted
Rating:
#1 (In Topic #923)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Hi Everyone

I hope someone can spot my error as I can not and this is driving me nuts

Code

    $Query &= "Select "
    $Query &= "function, "
    $Query &= "linenumber,  "
    $Query &= "lineaglinment, "
    $Query &= "linefont, "
    $Query &= "Replace(linetext, ",, ", ", ") As Linetext "
    $Query &= "from rec_table "
    $Query &= "Where function='" & RecipitMode & "' order by linenumber ASC;"

The above SQL code works on Windows VB.net but I can not seem to get it to work correct on Gambas could someone Please point out where i have gone wrong (as I have been working on this all day)

Thank-you
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
 i do not know SQL but this line is wrong…

$Query &= "Replace(linetext, ",, ", ", ") As Linetext "

the Replace is a vb command not a sql one

maybe…

$Query &= Replace(linetext, ",, ", ", ")

(just a guess, it's something like that)
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’

BruceSteers said

i do not know SQL but this line is wrong…

$Query &= "Replace(linetext, ",, ", ", ") As Linetext "

the Replace is a vb command not a sql one

maybe…

$Query &= Replace(linetext, ",, ", ", ")

(just a guess, it's something like that)

i could be wrong and it is sql command in which case …
$Query &= "Replace(linetext, ",, ", ", ") As Linetext "

(backslash the quotes)

Like i say i do not know sql but understanding what that line is supposed to do and doing it the gambas way is the key to fixing the problem.
Online now: No Back to the top

Post

Posted
Rating:
#4
Online now: No Back to the top

Post

Posted
Rating:
#5
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Thanks Guys I shall have a read of that other forum tomorrow morning.
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’

Code (gambas)

  1.  "\"" & sVariableName & "\""

this is the same  this :

Code (gambas)

  1.  Quote(sVariableName)

When building a string to query a SQL file and a little eraser to write  :D
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
I do alot of mysql with gambas. I would have to agree that we need some more information. If you can show us what the data in the table looks like along with what VB.net is returning then what you get on gambas I think I can help you.
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
 I suggest that you look at the gb.db.SQLRequest class if you have a lot of these to do.
It takes a bit of getting used to but in the end it makes building sql statements quite easy.
b

Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
Are there any examples of how to use it .... sample programs ?
Online now: No Back to the top
1 guest and 0 members have just viewed this.