Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Not Getting Data Back From Stored Proc Call

Not Getting Data Back From Stored Proc Call

Scheduled Pinned Locked Moved C#
data-structuresquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Marois
    wrote on last edited by
    #1

    I am passing in the procedure name and a parameter array. The values in the array are correct, yet I'm not getting any data back:

    public DataSet ExecuteQueryProc(string sParameterName, SqlParameter[] ParamArray)
    {
    DataSet oDataSet = new DataSet();

    SqlConnection oConn = GetConnection(true);
    
    if (oConn != null)
    {
        SqlCommand oCommand = new SqlCommand();
        oCommand.Connection = oConn;
        oCommand.CommandText = sParameterName;
        oCommand.CommandType = CommandType.StoredProcedure;
    
        oCommand.Parameters.AddRange(ParamArray);
    
        SqlDataAdapter oAdapter = new SqlDataAdapter();
        oAdapter.SelectCommand = oCommand;
        oAdapter.Fill(oDataSet);
    
    }
    return oDataSet;
    

    }

    Anyone wanna take a stab it this?

    Everything makes sense in someone's mind

    K A 2 Replies Last reply
    0
    • K Kevin Marois

      I am passing in the procedure name and a parameter array. The values in the array are correct, yet I'm not getting any data back:

      public DataSet ExecuteQueryProc(string sParameterName, SqlParameter[] ParamArray)
      {
      DataSet oDataSet = new DataSet();

      SqlConnection oConn = GetConnection(true);
      
      if (oConn != null)
      {
          SqlCommand oCommand = new SqlCommand();
          oCommand.Connection = oConn;
          oCommand.CommandText = sParameterName;
          oCommand.CommandType = CommandType.StoredProcedure;
      
          oCommand.Parameters.AddRange(ParamArray);
      
          SqlDataAdapter oAdapter = new SqlDataAdapter();
          oAdapter.SelectCommand = oCommand;
          oAdapter.Fill(oDataSet);
      
      }
      return oDataSet;
      

      }

      Anyone wanna take a stab it this?

      Everything makes sense in someone's mind

      K Offline
      K Offline
      KaptinKrunch
      wrote on last edited by
      #2

      oConn equaling null would result in no data.

      Just because we can; does not mean we should.

      1 Reply Last reply
      0
      • K Kevin Marois

        I am passing in the procedure name and a parameter array. The values in the array are correct, yet I'm not getting any data back:

        public DataSet ExecuteQueryProc(string sParameterName, SqlParameter[] ParamArray)
        {
        DataSet oDataSet = new DataSet();

        SqlConnection oConn = GetConnection(true);
        
        if (oConn != null)
        {
            SqlCommand oCommand = new SqlCommand();
            oCommand.Connection = oConn;
            oCommand.CommandText = sParameterName;
            oCommand.CommandType = CommandType.StoredProcedure;
        
            oCommand.Parameters.AddRange(ParamArray);
        
            SqlDataAdapter oAdapter = new SqlDataAdapter();
            oAdapter.SelectCommand = oCommand;
            oAdapter.Fill(oDataSet);
        
        }
        return oDataSet;
        

        }

        Anyone wanna take a stab it this?

        Everything makes sense in someone's mind

        A Offline
        A Offline
        Ashfield
        wrote on last edited by
        #3

        Have you tried running the proc in query analyser with the EXACT paramters you are passing? Its often easy to get a trailng space on a string that results in no data, or similar problems. I often just do a bit of code to generate the exact call (with the param values in the correct quites etc), then test it in query analyser.

        Bob Ashfield Consultants Ltd

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups