View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Parameters and DateTime

Use something like

mySQL = "INSERT INTO MYTABLE VALUES ( " & _
"firstField='Hello'," & _
"secondField='" param2 & "@'," & _
"thirdField='World'," & _
"lastField='" & param4 & "');"


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Goofy" wrote in message
...
This question is twofold, but related in a sense so I posted them

together.

I am using an ODBC Microsoft SQL driver and ADO. I tried to use parameters
but ended up with a message telling me that the variables @Whatever had

not
been set. I know the code was good and when I looked the error message up

on
the internet, someone said that named parameters are not supported on th
ODBC Driver for Microsoft SQL and you have to use positional parameters ?
placeholders. So

1.) Is this correct about the placeholders.

2.) If so, is it the order SQL placeholders are found in the sqlString and
can you intersperse them. for instance.

INSERT INTO MYTABLE VALUES (
firstField='Hello',secondField=?,thirdField='World ',lastField=?);

In this case is it the order which I created the parameters in the command
object which dictactes which one to pick up next ?

3.) Lastly, I have the standard situation where the sever takes dates in

US
format by string, someone told me that if you use parameters then you can
assign the parameter a UK format and the server will take it as a

parameter
an store it in the UK Format.

Is this true ?

Thanks so much for your help !