sqltransaction什么意思Decimal赋值DBNull
private ic vo PrepareCommand(SqlCommand cmd, SqlConnection conn, SqlTransaction ans, string cmdTt, SqlParameter[] cmdPas) { if (conn.State != ConnectionState.Open) { conn.Open(); } cmd.Connection = conn; cmd.CommandText = cmdText; if (trans != null) cmd.Transaction = trans; cmd.CommandType = CommandType.Text;//cmdType; if (cmdParms != null) { foreach (SqlParameter parm in cmdParms) { if (parm.SqlDbType == SqlDbType.DateTime parm.Value != DBNull.Value) { if ((DateTime)parm.Value == DateTime.MinValue) parm.Value = System.DBNull.Value; } if (parm.SqlDbType == SqlDbType.Decimal parm.Value != DBNull.Value) { try { decimal = (decimal)parm.Value; if ((decimal)parm.Value == decimal.MinValue) parm.Value = System.DBNull.Value; } ch (Exception ex) { string ss = //parm.Value = System.DBNull.Value; } } cmd.Parameters.Add(parm); } } }
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论