i am passing values to stored procedure from .net through command parameters.when i pass values like

string City="'Lucknow','Kanpur'";
Com.Parameter.AddWithValues("@Cities",City);


create procedure SPGetState
@Cities varchar(2000)
As
Select * from Temp Where City in(@Cities)

i can't get the result.But i run this in Sql Query Analyzer ,i get the result.What;s the problem,i can't find................

Recommended Answers

All 2 Replies

Remove the single quote from city names, and check if it doesn't work. Catch it on the profile (see how your application sends it to the SQL Server) get the query and run it on SSMS and check what's the error.

I tried the exact same thing, it seems to be working!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.