本文整理汇总了C#中IDbDataParameter.IsNotNull方法的典型用法代码示例。如果您正苦于以下问题:C# IDbDataParameter.IsNotNull方法的具体用法?C# IDbDataParameter.IsNotNull怎么用?C# IDbDataParameter.IsNotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDbDataParameter
的用法示例。
在下文中一共展示了IDbDataParameter.IsNotNull方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}