Hi All,

I have a couple of problems trying to use the API in .NET

I have declared the following API:

<DllImport("Kernel32", BestFitMapping:=False, CallingConvention:=CallingConvention.StdCall, _
CharSet:=CharSet.Unicode, EntryPoint:="GetPrivateProfileStringA", ExactSpelling:=True)> _
Public Function GetPrivateProfileString(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
End Function

When I run my code and call the above function. Where I have checked the filename/path is correct and similarly the section and key, I am returned an empty string in lpReturnString??

The next one relates to ODBC.

<DllImport("odbc32.dll", BestFitMapping:=False, CallingConvention:=CallingConvention.StdCall, _
CharSet:=CharSet.Unicode, EntryPoint:="SQLAllocEnv", ExactSpelling:=True)> _
Public Shared Function SQLAllocEnv(ByVal phenv As Integer) As Short
'leave this function empty
End Function

again when I call this, I have -1 being returned and I do not know why.

Any help would be appreciated.