DB connection in SQL CE



Hi All,

I'm new to SQL CE and i'm using SQL CE 2.0.
I've created the database and created a table 'Employees' and when i tried to insert a row into the table i'm getting the negative value for hr.

I'm using the handheld device CASIO IT700 to run the application using ActiveSync.
The code is:

InitializeReplicationRDA();
hr = CoCreateInstance(CLSID_RemoteDataAccess, NULL, CLSCTX_INPROC_SERVER, IID_ISSCERDA, (LPVOID *)&CERDA);
CERDA->put_InternetURL(L"http://localhost/VirtualServer/sscesa20.dll";);
CERDA->put_InternetLogin(L"sa");
CERDA->put_InternetPassword(L"sqladmin");
CERDA->put_LocalConnectionString(L"Provider=microsoft.sqlserver.oledb.ce.2.0;Data Source=NewDatabase.sdf");
wcscpy(wszConnectString, L"provider=sqloledb; data source=system81; Initial Catalog=NewDatabase.sdf; user id=sa; password=sqladmin");
wcscpy(wszLocalTable, L"Employees");
wcscpy(wszErrorTable, L"T1_Err");
wcscpy(wszQuery, L"INSERT INTO Employees values ('Davolio','Nancy'))");
bstrConnectStr = SysAllocString(wszConnectString);
bstrQuery = SysAllocString(wszQuery);
hr = CERDA->SubmitSQL((WCHAR*)bstrQuery,
(WCHAR*)bstrConnectStr);
if(FAILED(hr))
{
goto Exit;
}
SysFreeString(bstrQuery);
SysFreeString(bstrConnectStr);
CERDA->Release();

Exit:

Kindly help me.

Regards,
Farzana.

From http://developmentnow.com/g/97_0_0_0_0_0/sql-server-ce.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
.