Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / August 2008



Tip: Looking for answers? Try searching our database.

"dbCmd.CommandType = adCmdText" adds the words "select * from " to     dbCmd.CommandText.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shmuel - 13 Aug 2008 05:16 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.