Return Result from Select Query in stored procedure to a List

前端 未结 8 2016
猫巷女王i
猫巷女王i 2021-01-01 10:10

I\'m writing a stored procedure that currently contains only a SELECT query. It will be expanded to do a number of other things, which is why it has to be a sto

8条回答
  •  难免孤独
    2021-01-01 10:15

    Passing Parameters in Stored Procedure and calling it in C# Code behind as shown below?

    SqlConnection conn = new SqlConnection(func.internalConnection);
    var cmd = new SqlCommand("usp_CustomerPortalOrderDetails", conn);
    cmd.CommandType = System.Data.CommandType.StoredProcedure;
    cmd.Parameters.Add("@CustomerId", SqlDbType.Int).Value = customerId;
    cmd.Parameters.Add("@Qid", SqlDbType.VarChar).Value = qid;
    conn.Open();
    
    // Populate Production Panels
    DataTable listCustomerJobDetails = new DataTable();
    listCustomerJobDetails.Load(cmd.ExecuteReader());
    conn.Close();
    

提交回复
热议问题