Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2004, 03:31 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default mismatch string

strUpdate = "update tblCustRate set dtRateFrom =" + ndateFrom + _
                ", dtRateTo =" + ndateUntil+ _
                ", decHourlyRate=" + nHourlyRate+ _
                " where iEmpID =" + iEmpID +_
                " and iTaskiD=" + iTaskID +_

                 " and iProjDetiD=" + iProjDetID

  it gives me an error mismatch string. From the data base I am updating numbers like 9/11/2003, 9/10/2004 and 50. But when i use
the code below it works fine. Please explain me the reason. Thanks

strUpdate = "update tblCustRate set dtRateFrom =" & ndateFrom & _
                ", dtRateTo =" & ndateUntil& _
                ", decHourlyRate=" & nHourlyRate& _
                " where iEmpID =" & iEmpID &_
                " and iTaskiD=" & iTaskID &_

                 " and iProjDetiD=" + iProjDetID



 
Old October 27th, 2004, 03:59 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Whenever possible use an "&" (ampersand) to concatenate strings in VBScript. When you use "+" to concatenate string and a number for eg. ("this is a test" + 5 )it does not know how to reconcile the two different types to get them to work together.
 
Old October 27th, 2004, 05:52 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I didnot understand what you want to say. Explain me in detail. Regards shoakat

 
Old October 27th, 2004, 07:50 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes,

  Better to use & as concatenation operator.
And, which database are you using? Access/SQL server ?
If access, in your sql statement, check the query.
Dates are followed by #9/1/2003#


---------
Rajani

 
Old October 29th, 2004, 01:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Shoakat,

I think you are mixing up with + and & operators in relation to VBScript and T-SQL

Use & as concatenation operator in VBScript.
Use + as concatenation operator in T-Sql.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Mismatch error Sheraz Khan ASP.NET 2.0 Basics 3 May 16th, 2007 10:50 AM
DataType Mismatch webgen ASP.NET 1.0 and 1.1 Professional 3 November 17th, 2005 12:35 PM
Type mismatch NoBullMan Classic ASP Basics 2 November 16th, 2004 03:16 AM
Type mismatch per.holleufer Classic ASP Basics 5 July 31st, 2004 07:33 AM
Type mismatch sporkman43 Classic ASP Basics 4 August 14th, 2003 03:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.