本文整理汇总了C#中System.Data.Odbc.OdbcStatementHandle.GetStatementAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# OdbcStatementHandle.GetStatementAttribute方法的具体用法?C# OdbcStatementHandle.GetStatementAttribute怎么用?C# OdbcStatementHandle.GetStatementAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Odbc.OdbcStatementHandle
的用法示例。
在下文中一共展示了OdbcStatementHandle.GetStatementAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OdbcHandle
internal OdbcHandle(OdbcStatementHandle parentHandle, ODBC32.SQL_ATTR attribute) : base(IntPtr.Zero, true)
{
ODBC32.RetCode code;
this._handleType = ODBC32.SQL_HANDLE.DESC;
bool success = false;
RuntimeHelpers.PrepareConstrainedRegions();
try
{
int num;
parentHandle.DangerousAddRef(ref success);
code = parentHandle.GetStatementAttribute(attribute, out this.handle, out num);
}
finally
{
if (success)
{
if (IntPtr.Zero != base.handle)
{
this._parentHandle = parentHandle;
}
else
{
parentHandle.DangerousRelease();
}
}
}
if (ADP.PtrZero == base.handle)
{
throw ODBC.FailedToGetDescriptorHandle(code);
}
}
示例2: OdbcHandle
internal OdbcHandle(OdbcStatementHandle parentHandle, ODBC32.SQL_ATTR attribute) : base(IntPtr.Zero, true) {
Debug.Assert((ODBC32.SQL_ATTR.APP_PARAM_DESC == attribute) || (ODBC32.SQL_ATTR.APP_ROW_DESC == attribute), "invalid attribute");
_handleType = ODBC32.SQL_HANDLE.DESC;
int cbActual;
ODBC32.RetCode retcode;
bool mustRelease = false;
RuntimeHelpers.PrepareConstrainedRegions();
try {
// must addref before calling native so it won't be released just after
parentHandle.DangerousAddRef(ref mustRelease);
retcode = parentHandle.GetStatementAttribute(attribute, out base.handle, out cbActual);
}
finally {
if (mustRelease) {
if (IntPtr.Zero != base.handle) {
// must call DangerousAddRef after a handle is actually created
// since ReleaseHandle will only call DangerousRelease if a handle exists
_parentHandle = parentHandle;
}
else {
// without a handle, ReleaseHandle may not be called
parentHandle.DangerousRelease();
}
}
}
if (ADP.PtrZero == base.handle) {
throw ODBC.FailedToGetDescriptorHandle(retcode);
}
// no info-message handle on getting a descriptor handle
}