I am converting vb6 code to use sql server instead of access
dim ...
strCon = .....
dbConn.ConnectionString = strCon
dbConn.Open
dbCmd.ActiveConnection = dbConn
dbCmd.CommandType = adCmdText
dbCmd.CommandText = "select max(input_date) as last_date from cost"
Set rslast_date = dbCmd.Execute
However, for some reason "dbCmd.CommandType = adCmdText" adds the
words "select * from " to dbCmd.CommandText.
It doesn't make a difference if I put"dbCmd.CommandType = adCmdText"
or after dbCmd.CommandText I always end up with "select * from select
max(input_date) as last_date from cost"
Help it is driving me crazy!!!!!!!!!
Shmuel Lewitan
Ralph - 13 Aug 2008 08:54 GMT
> I am converting vb6 code to use sql server instead of access
> dim ...
[quoted text clipped - 13 lines]
> Help it is driving me crazy!!!!!!!!!
> Shmuel Lewitan
Can't say I ever saw that before. Are you re-using the dbCmd object. Try
making a new one, then set attributes.
Richard Mueller [MVP] - 13 Aug 2008 14:06 GMT
>I am converting vb6 code to use sql server instead of access
> dim ...
[quoted text clipped - 13 lines]
> Help it is driving me crazy!!!!!!!!!
> Shmuel Lewitan
I also use similar code all the time and have never seen anything like this.
What does your connection string look like? Are you using "DRIVER=SQL
Server;"?

Signature
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Shmuel - 15 Aug 2008 04:24 GMT
Hi,
I am embarrassed to say the source of the behavior was the fact I was
porting code from ASP so adCmdText was set to equal 2 not 1 as it is
in vb.
Sorry for wasting your time.
All the best,
Shmuel