in-line parameters in stored procedures
I'm trying to execute a SqlCommand using an SQL string that includes the name of the stored proc and two input parameters -- but I'm not getting any records returned, even though when I run the stored proc in query analyzer or from server explorer in vs.net, I do get a record. Here's my code:
public SqlDataReader RunSP(string proc, ref string errMsg)
SqlConnection cnn = new SqlConnection(_connectString);
SqlCommand cmd = new SqlCommand(proc, cnn);
catch (Exception e)
errMsg = e.Message;
Here's the value of the proc string:
Document_Load 48, 'X233X2983JIOKSJB'
I know this should be returning records, but it's not. Does anything jump out as being wrong? Oh, and here's the connect string I'm using, in case I have a wrong parameter or something:
Data Source=mycomputername;Initial Catalog=DatabaseName;User Id=steve;Password=password;
Thanks in advance if anyone can shed some light. In case you're wondering, I'm not building parameters because I want this to be a generic method that I can call from different objects, just passing in the SQL string.