/*
* 作者:吴隆健
* 日期: 2019-04-07
* 时间: 20:05
*
*/
#if MMSQL
using System;
using System.Data;
using System.Data.SqlClient;
namespace MrWu.DB
{
///
/// 存储过程查询键
///
public class SqlProcedureParameter : IProdureParameter
{
SqlCommand _sqlcommand;
///
/// 查询键
///
public SqlCommand command
{
get => _sqlcommand;
}
private string _dbName;
///
/// 数据库名称
///
public string dbName
{
get => _dbName;
}
///
/// 错误信息
///
public Exception exception { get; set; }
///
/// 是否报错
///
public bool isException
{
get { return exception != null; }
}
private SqlProcedureParameter()
{
}
internal SqlProcedureParameter(SqlCommand sqlcommand, string dbName)
{
this._sqlcommand = sqlcommand;
this._dbName = dbName;
}
///
/// 释放
///
public void Dispose()
{
if (_sqlcommand != null)
{
_sqlcommand.Dispose();
_sqlcommand = null;
}
}
}
///
/// 单独设置参数
///
public class SqlAloneParameter : ISqlAloneParameter
{
string _paramname;
///
/// 参数名称
///
public string paramname
{
get => _paramname;
}
object _paramvalue;
///
/// 参数值
///
public object paramvalue
{
get => _paramvalue;
set => _paramvalue = value;
}
SqlDbType _type;
///
/// 参数类型
///
public SqlDbType type => _type;
int _valueLength;
///
/// 参数长度
///
public int valueLength => _valueLength;
///
/// sql语句单独设置参数
///
/// 参数名称
/// 参数值
/// 参数值的长度
/// 参数类型
public SqlAloneParameter(string paramname, object paramvalue, int valuelength = 0,
SqlDbType type = SqlDbType.Binary)
{
this._paramname = paramname;
this._paramvalue = paramvalue;
this._valueLength = valuelength;
this._type = type;
}
///
/// Direction
///
public ParameterDirection Direction { get; set; }
}
}
#endif