Monday, February 13, 2012

Adding C++ var into db

Since the SQL server doesn't have visibility to internal
C++ variables in an application, the variables need to be
passed to the server somehow. There are a variety of ways
of doing this including converting the value to text and
stuffing it in the query string. A better way is to use
the API's parameter passing functions (i.e. for ODBC this
is SQLBindParameter).
Cheers
Mitch vH
Microsoft Consulting

>--Original Message--
>What is the syntax of adding C++ variables into SQL
Server/mySQL?
>Could anyone raise an example?
>I've tried
>insert into aTable (field1, field2) values (variable1,
variable2)
>But mysql throws error messages at me saying varible1 is
not in the field
>list. Haven't tried it yet for SQL Server..
>Thanks for your attention
>Jack
>
>.
>Hi Mitch,
Nice to meet you. According to your message, I'd like to know if you can
raise an example for me to reference. Thanks
Jack
"Mitch" <anonymous@.discussions.microsoft.com>
'?:537a01c42cd1$c241b690$a301280a@.phx.gbl...[vbcol=seagreen]
> Since the SQL server doesn't have visibility to internal
> C++ variables in an application, the variables need to be
> passed to the server somehow. There are a variety of ways
> of doing this including converting the value to text and
> stuffing it in the query string. A better way is to use
> the API's parameter passing functions (i.e. for ODBC this
> is SQLBindParameter).
> Cheers
> Mitch vH
> Microsoft Consulting
>
> Server/mySQL?
> variable2)
> not in the field|||Hi,
I've just asked other guys. They said to convert integers into varchars
using sprintf then stuffing it into the SQLStr. I'm in doubt about the
necessarity of this move because the field I designed was an integer field.
Could anyone explain?
Thanks
Jack
"Jack" <jl@.knight.com> glsD
:Oim1KPNLEHA.2624@.TK2MSFTNGP09.phx.gbl...
> Hi Mitch,
> Nice to meet you. According to your message, I'd like to know if you can
> raise an example for me to reference. Thanks
> Jack
> "Mitch" <anonymous@.discussions.microsoft.com>
> '?:537a01c42cd1$c241b690$a301280a@.phx.gbl...
>

No comments:

Post a Comment