Click here to Skip to main content
15,881,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,
I'm having problem when deploying my web application.
My application runs fine in website application, but when i convert to web application project, its showing some errors when i compile.

The error shows as - Too many characters in character literal in sql query,

where i m using dataset in my application to filter search in my developer express report.So,the error is from .xsd file,from sql query :

example:
SQL
<CommandText>
SELECT TOP (100) PERCENT CSGNDTL.ItemCode AS MBBTag, 
       CAST(GRDTL.SerialNoList AS nvarchar(30)) AS SerialNumber, 
       GRDTL.UDF_FANumber AS FANumber, GRDTL.UDF_CSCManagedNumber AS CSCManagedCode, 
       Item.Description AS ModelNo, Item.Desc2 AS ModelName, 
       ItemType.Description AS Classification, 
       Location.Location + ' - ' + Location.Description AS Location, 
       CSGN.CreatedUserID AS ApproveBy, CSGN.CreatedTimeStamp AS ApproveDate,
       Item.UDF_OwnerShip
FROM CSGN 
INNER JOIN CSGNDTL ON CSGN.DocKey = CSGNDTL.DocKey 
INNER JOIN GRDTL ON CSGNDTL.ItemCode = GRDTL.ItemCode 
INNER JOIN Debtor ON CSGN.DebtorName = Debtor.CompanyName 
INNER JOIN Item ON CSGNDTL.ItemCode = Item.ItemCode 
INNER JOIN Location ON CSGNDTL.Location = Location.Location 
INNER JOIN ItemType ON Item.UDF_Classification = ItemType.ItemType 
INNER JOIN SerialNoTrans ON CSGNDTL.DtlKey = SerialNoTrans.DtlKey 
WHERE (CSGN.Description = 'ACTIVE') AND (Location.Location LIKE @Location) 
ORDER BY ApproveDate DESC
</CommandText>


the error shows at wherever i use the ' - ' and 'ACTIVE'

anyone knows what causing this error?
Posted
Updated 16-Dec-20 4:20am
v4

1 solution

Normally, single quotes i.e.
' '
are used for specifying character literal that is of 2 bytes ==> only one character.
Whereas when we want to use string or a number of characters, we use double quotes i.e.
" "
.
Thats where the problem is. Just try changing single quotes to double and you'll be there!
Good Luck!
 
Share this answer
 
Comments
PIEBALDconsult 16-Dec-20 11:03am    
In C, but not in SQL.
Richard Deeming 16-Dec-20 12:02pm    
Did you notice the date?

It looks like Chris fixed the code formatting, and dragged it back to the top of the list.
PIEBALDconsult 16-Dec-20 12:20pm    
Yes, it took me a while to figure that out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900