In-Out Parameter for SqlCommand

前端 未结 4 479
一整个雨季
一整个雨季 2020-12-11 15:44

I have the following parameter for SqlCommand. How do I make it to both in and out the paramter value for the Stored Procedure.

 SqlCommand mySqlCommand = ne         


        
4条回答
  •  自闭症患者
    2020-12-11 16:34

    var pInOut = mySqlCommand.Parameters.Add("@DataRows", dataStringToProcess.ToString());
    pInOut.Direction = ParameterDirection.InputOutput;
    

    And then to read the output value after you've executed the command:

    // assumes that the parameter is a string and that it could possibly be null
    string value = Convert.IsDBNull(pInOut.Value) ? null : (string)pInOut.Value;
    

提交回复
热议问题