本文整理汇总了C#中IDbDataParameter.IsNull方法的典型用法代码示例。如果您正苦于以下问题:C# IDbDataParameter.IsNull方法的具体用法?C# IDbDataParameter.IsNull怎么用?C# IDbDataParameter.IsNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDbDataParameter
的用法示例。
在下文中一共展示了IDbDataParameter.IsNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadReportSourceDataSet
public void LoadReportSourceDataSet(ref DataSet dsRef, CommandType cmdType, String strCmdText, IDbDataParameter[] sqlParam)
{
ConnectionManager conManager = new ConnectionManager(ConName);
IDataReader reader = null;
try
{
if (sqlParam.IsNull() || sqlParam.Length.IsZero())
conManager.OpenDataReader(strCmdText, out reader);
else
conManager.OpenDataReader(out reader, strCmdText, sqlParam);
//
dsRef = Util.DataReaderToDataSet(reader);
}
catch (Exception ex)
{
throw (ex);
}
finally
{
if (conManager != null)
{
conManager.CloseConnection();
conManager.Dispose();
}
if (reader.IsNotNull() && reader.IsClosed.IsFalse())
reader.Close();
}
}
示例2: OpenDataReader
public void OpenDataReader(String query, out IDataReader readerRef,
CommandBehavior behaviour, Boolean requiredTransaction, String procedureName,
IDbDataParameter[] oleDbParameterArray, String conName)
{
IDbCommand mainCommand;
try
{
if ((procedureName.Trim()).Length.IsZero())
{
if ((query.Trim()).Length.IsZero())
throw new Exception("Query is blank");
}
switch (ProviderType)
{
case Util.ConnectionLibrary.SQlClient:
mainCommand = new SqlCommand();
break;
case Util.ConnectionLibrary.Oledb:
mainCommand = new OleDbCommand();
break;
case Util.ConnectionLibrary.ODBC:
mainCommand = new OdbcCommand();
break;
default:
mainCommand = null;
break;
}
if (mainCommand.IsNull())
{
readerRef = null;
return;
}
if (requiredTransaction.IsFalse())
{
if (conName.Length > 0)
{
OpenConnection(conName);
}
else
{
OpenConnection(String.Empty);
}
}
else
{
mainCommand.Transaction = transaction;
}
if ((procedureName.Trim()).Length.IsZero())
{
mainCommand.CommandType = CommandType.Text;
mainCommand.CommandText = query;
}
else if (oleDbParameterArray.IsNull() && (procedureName.Trim()).Length > 0)
{
mainCommand.CommandType = CommandType.StoredProcedure;
mainCommand.CommandText = procedureName;
}
else if (oleDbParameterArray.IsNotNull() && (procedureName.Trim()).Length > 0)
{
mainCommand.CommandType = CommandType.StoredProcedure;
mainCommand.CommandText = procedureName;
for (Int32 i = 0; i < oleDbParameterArray.Length; i++)
{
if (oleDbParameterArray[i].IsNotNull())
{
mainCommand.Parameters.Add(oleDbParameterArray[i]);
}
}
}
else
{
throw new Exception("Could Not Create the Command Object");
}
mainCommand.CommandTimeout = CommandTimeOutValue;
mainCommand.Connection = disconnection;
readerRef = mainCommand.ExecuteReader(behaviour);
}
catch (Exception ex)
{
CloseConnection();
throw (ex);
}
}