Need to get Multiple tables from SqlServer at a time

Posted by narmadha on Stack Overflow See other posts from Stack Overflow or by narmadha
Published on 2010-04-20T07:06:23Z Indexed on 2010/04/20 7:13 UTC
Read the original article Hit count: 251

Filed under:

Hi ,I am working with C#.net,I am using cursor concept in my storedprocedure,While executing it in Sqlserver it is showing Multiple tables,but it is not returning multiple Tables in the code,it is returning only the first table,The following is the code which i have used:

                DataSet ds = new DataSet("table1");
              using (SqlConnection connection = new SqlConnection(connectionstring))
                 {
                using (SqlDataAdapter da = new         SqlDataAdapter("getworkpersondetails_Orderidwise", connection))
                    {
               da.SelectCommand.CommandType = CommandType.StoredProcedure;
              SqlParameter param;
              param = new SqlParameter("@OrderId", SqlDbType.Int);
              param.Value = OrderId;
              da.SelectCommand.Parameters.Add(param);
             param = new SqlParameter("@CompanyId", SqlDbType.Int);
             param.Value = CompanyId;
             da.SelectCommand.Parameters.Add(param);
             connection.Open();
             da.Fill(ds);
             connection.Close();
             return ds;

        }

    }

© Stack Overflow or respective owner

Related posts about c#2.0