How to pass a null variable to a SQL Stored Procedure from C#.net code

前端 未结 8 426
失恋的感觉
失恋的感觉 2020-12-02 19:41

Im calling a SQL stored procedure from a piece of C#.net code:

SqlHelper.ExecuteDataset(sqlConnection, CommandType.StoredProcedure, STORED_PROC_NAME, sqlPara         


        
8条回答
  •  时光取名叫无心
    2020-12-02 20:29

        SQLParam = cmd.Parameters.Add("@RetailerID", SqlDbType.Int, 4)
        If p_RetailerID.Length = 0 Or p_RetailerID = "0" Then
            SQLParam.Value = DBNull.Value
        Else
            SQLParam.Value = p_RetailerID
        End If
    

提交回复
热议问题