Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 12th, 2003, 09:57 PM
Authorized User
Join Date: Jun 2003
Location: Forest, VA, USA.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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);
        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 building parameters because I want this to be a generic method that I can call from different objects, just passing in the SQL string.

iTek Corporation
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedures KeviJay VB Databases Basics 1 June 5th, 2008 07:17 AM
stored procedures thillaiarasu ASP.NET 2.0 Basics 2 May 3rd, 2007 07:55 AM
SQL Pass though parameters to stored procedures blinton25 SQL Server 2000 3 March 29th, 2004 02:49 PM
Calling Stored procedures with out parameters bansalh Access 1 November 25th, 2003 04:30 PM

All times are GMT -4. The time now is 09:51 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.