CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Sql String

Print topic Send  topic

Author Message
Ernest
Posted: 04/13/2005, 7:44 PM

Using Codecharge 2.3
Sql Server 2000

Trying to combine the First + Middle + Last name fields. I've done this using code charge and MS Access using the string below and it works perfectly:

SQL = "SELECT [PersonnelId], [GroupID], [Troop], [Post], [AccessLevel], [FName]&' '&[LName] As Employee FROM [Personnel] WHERE [AllowLogin] = 1 AND [UserName]='" & Replace(Login, "'", "''") & "' AND [Pswd]='" & Replace(Password, "'", "''") & "'"

Using Sql Server 2000 i get error. If I select one of the name parts ie: (FName AS Employee), it works. Only gives the error when I try to combine two or more.

Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/Gsp/Common.asp, line 1584

Is the syntax different for Sql as opposed to Access?

Thanks

Ernest


Nicole

Posts: 586
Posted: 04/14/2005, 2:43 AM

Ernest,
Access and SQL Server have different syntax. Use plus (+) instead of ampersand (&) with SQL server:
SELECT FName + LName as EName from table_name

Also keep in mind that if fields are of different data type you need to convert them to the same data type using CAST() or CONVERT() functions.

_________________
Regards,
Nicole
View profile  Send private message
Ernest
Posted: 04/14/2005, 8:09 AM

THANKS !!!!

Solved the problem

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.