AnsweredAssumed Answered

FMSA11 FileMaker ODBC returns nulls for text fields

Question asked by ranja on Jun 1, 2010
Latest reply on Jun 7, 2010 by ranja


FMSA11 FileMaker ODBC returns nulls for text fields

Your post

FileMaker Server Advanced v11
Windows Server 2008R2 32bit (Japanese)
Visual Studio 2010
FileMaker ODBC v11.00.61.00

When I access to FileMaker Server 11 via OLEDB, the values of text fields are not returned in certain cases.
Here is my sample code:

#include "stdafx.h"
#include <atldbcli.h>
class CGetUserList
DEFINE_COMMAND_EX(CGetUserList, L"SELECT u.UserID, u.FullName, u.Privilege FROM UserAccount AS u ORDER BY u.UserID")

WCHAR m_UserID[11];
WCHAR m_FullName[41];
LONG m_Privilege;

COLUMN_ENTRY(2, m_FullName)
COLUMN_ENTRY(3, m_Privilege)
int _tmain(int argc, _TCHAR* argv[])
LPCWSTR conn = L"Provider=MSDASQL.1;Password=MyPassword;Persist Security Info=True;User ID=Admin;Extended Properties=\"DRIVER={FileMaker ODBC};SERVER=MyServer;DATABASE=MyDatabase\"";
HRESULT hr = ::CoInitialize(NULL);
if(hr == S_OK){
CDataConnection dc;
hr = dc.Open(conn);
if(hr == S_OK){
CCommand<CAccessor<CGetUserList> > cmd;
hr = cmd.Open(dc, NULL, NULL);
if(hr == S_OK){
while(cmd.MoveNext() == S_OK)
return 0;

Well, the above code works fine. But after I changed the SQL to something like
SELECT u.UserID, 'Test' AS FullName, u.Privilege FROM UserAccount AS u ORDER BY u.UserID
then not only cmd.m_FullName but also cmd.m_UserID becomes empty. Numeric fields (like the third 'Privilege' field) have no problem.
Also, when the SQL contains 'JOIN' (INNER JOIN or OUTER JOIN), all the text fields return nulls.
Of course, FMSA v10 had no such problem. Universal SQL Editor and Access 2010 (via ODBC) do not have that phenomenon, either.
What is wrong?