利用C#开发科技档案管理系统(二)
2009-02-27 08:18:21 来源:WEB开发网(3)释放数据库连接资源-- SqlCon
#region
public void Dispose()
{
if (SqlCon != null)
{
SqlCon.Dispose();
SqlCon = null;
}
}
#endregion
(4)传入参数并且转换为SqlParameter类型
#region
public SqlParameter MakeInParam(string ParamName, SqlDbType DbType, int Size, object Value)
{
return MakeParam(ParamName, DbType, Size, ParameterDirection.Input, Value);
}
public SqlParameter MakeParam(string ParamName, SqlDbType DbType, Int32 Size, ParameterDirection Direction, object Value)
{
SqlParameter param;
if (Size > 0)
param = new SqlParameter(ParamName, DbType, Size);
else
param = new SqlParameter(ParamName, DbType);
param.Direction = Direction;
if (!(Direction == ParameterDirection.Output && Value == null))
param.Value = Value;
return param;
}
#endregion
更多精彩
赞助商链接