Avatar of Wayne Barron
Wayne Barron
Flag for United States of America

asked on 

sql parameterized query question mark placement with single quote in code

Hello All;

In the following statement, I need to know how to place the ? for the parameterized Query.
The part we are looking at is
 (CHARINDEX('/?/', '/' + Tracks.LID) > 0)
When run in SSMS, this is the way it will look
 (CHARINDEX('/1/', '/' + Tracks.LID) > 0)
(Replacing the ? with a number)

sqlctLabel.commandtext="SELECT COUNT(DISTINCT Tracks.AlbumID) AS Albums FROM Tracks INNER JOIN Albums ON Tracks.AlbumID = Albums.AlbumID INNER JOIN Artists ON Albums.ArtistID = Artists.ArtistID WHERE (CHARINDEX('/?/', '/' + Tracks.LID) > 0) GROUP BY Artists.ArtistName, Artists.ArtistID"
sqlctLabel.Parameters.Append sqlctLabel.CreateParameter("@LID", adInteger, adParamInput, , strLabelID)

Open in new window

ASPMicrosoft SQL Server

Avatar of undefined
Last Comment

8/22/2022 - Mon