>
Interestingly enough, I pass your insert statement with single quotes and it
works fine:
sqlCommand = "insert into cbrSources(source,sourceCount,sourcedate) values("
sqlCommand = sqlCommand + "'Mazda of Bastrop'"+","
sqlCommand = sqlCommand + "1002,"
sqlCommand = sqlCommand + "'1998-09-01'"+");"
Double quotes (chr(34)) doesn't. If you are planning on allowing for single
quotes within your text, I suggest passing your strings through something
like the following routine so that it won't choke when a field has a quote in
it...
function StrToSQLStr(TheString as String) As String
dim SQLString as String
SQLString = TheString
SQLString = ReplaceAll(SQLString,"'","''") //SQL needs 2 quotes to represent
1 inside a string
SQLString = "'"+SQLString+"'"
return SQLString
end function
I haven't used RB's built in db at all (I've been using OpenBase), so it may
be a limitation.
-Brad Brack
-------------
In a message dated 9/13/99 12:57:27 PM, aaron at riverawoods dot com writes:
<<
>I'll take a quick stab at this and recommend that you don't use the reserved
>name 'count' as a field name.
>
>-Brad Brack
>
> - - - - - - - - - -
>For list commands, send "Help" in the body of a message to
><requests at lists dot realsoftware dot com>
I wish that fixed it, however changing count to sourceCount still
yields the same results: Mismatched INSERT columns
revised code:
dim dbitem as folderItem
dim db as database
dim sqlCommand as string
dbItem = gettemporaryFolderItem
db = NewREALDatabase(dbitem)
db.sqlExecute("create table cbrSources(source varchar(30),
sourceCount integer, sourcedate char(10));")
if db.error then
msgBox sqlCommand+":"+db.errorMessage
return
end
sqlCommand = "insert into cbrSources(source,sourceCount,sourcedate) values("
sqlCommand = sqlCommand + chr(34)+"Mazda of Bastrop"+chr(34)+","
sqlCommand = sqlCommand + "1002,"
sqlCommand = sqlCommand + chr(34)+"1998-09-01"+chr(34)+");"
db.sqlExecute(sqlCommand)
if db.error then
msgBox sqlCommand+":"+db.errorMessage
return
end
>>
- - - - - - - - - -
For list commands, send "Help" in the body of a message to
<requests at lists dot realsoftware dot com>
|