SQL Scripts & VB Variables

admin

Administrator
Staff member
Hello Everyone and how are you?

I have an ADO Command object in VB and I am curious on one thing...

The ADO Command object will allow you to set a sql command and then call the execute method.

When I call the .execute method it fails. In the commandtext, I am typing the following:

Command.CommandText = _
Insert Into Table (Name, Address) Values (PName, PAddress)
Command.Execute

PName and PAddress are string variables. Even though the command object can take a variable, it gives me a SQL server error saying:

PName is not allowed. Only constants, expressions or variables allowed here.

Something along those lines. PName and PAddress are string variables.

Any idea on why it will not recognize them?

Any help is appreciated!

Thanks,

Shane Escher
Seagate Software Development TPS Team

P.S. If you have any questions on Crystal Reports and development issues, please feel free to ask.

Also, this looks like a forum geared towards Linus/Unix users. If I am out of place regarding message posts (if this is Unix only), please let me know and I will stop posting! Thanks!
 
Back
Top