Visual Studio 2010
C#
Code:
public void GetFunctions(UInt32 vnFunction, out bool[] rbFunctions)
{
// Wrapper for the SQLGetFunctiosn API
try
{
SQLReturnCodes nSQLResults = Win32APISQL.SQLGetFunctions(hdbc, (short)vnFunction, out rbFunctions);
if (SQLReturnCodes.SQL_SUCCESS != nSQLResults)
CheckError("SQLGetFunctions: ", nSQLResults);
}
catch
{
int err = Marshal.GetLastWin32Error();
// throw new Win32Exception(err);
MessageBoxResult result = MessageBox.Show(err.ToString(), "ODBC 32", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
Where SQLGetFuncions is defined as:
[DllImport("odbc32.dll", SetLastError = true)]
public static extern SQLReturnCodes SQLGetFunctions(IntPtr hdbc, short fDirection,out bool[] pfExists);
The compiler generates the following error:
The out parameter 'rbFunctions' must be assigned to before control leaves the current method
http://www.saberman.com