Hello,
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)
{
try
{
SqlConnection cnn = new SqlConnection(_connectString);
cnn.Open();
SqlCommand cmd = new SqlCommand(proc, cnn);
return cmd.ExecuteReader();
}
catch (Exception e)
{
errMsg = e.Message;
return null;
}
}
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 using parameter objects because I want this to be a
generic method that I can call from different objects, just passing in
the SQL string.
Steve
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Leer las respuestas