Return Result from Select Query in stored procedure to a List

前端 未结 8 2027
猫巷女王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:28

     SqlConnection connection = new SqlConnection(ConnectionString);
    
     command = new SqlCommand("TestProcedure", connection);
     command.CommandType = System.Data.CommandType.StoredProcedure;
    
     connection.Open();
    
     DataTable dt = new DataTable();
    
     dt.Load(command.ExecuteReader());
    
     gvGrid.DataSource = dt;
     gvGrid.DataBind();
    

提交回复
热议问题