Wayne Barron
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)
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)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Got it.
Had to change my code around a little from
adInteger
To
adVarChar.
Works now.
Had to change my code around a little from
adInteger
To
adVarChar.
Works now.
Sorry, I should have seen the integer parameter issue ...
ASKER
As for the @LID
I tried it using your code, and I get this.