Click here to Skip to main content
15,902,635 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: SQL Server Compact Edition Pin
Chris-Kaiser6-Apr-07 18:30
Chris-Kaiser6-Apr-07 18:30 
QuestionSynchronize Data Pin
Blue_Boy4-Apr-07 1:02
Blue_Boy4-Apr-07 1:02 
AnswerRe: Synchronize Data Pin
PavanPareta11-Apr-07 23:04
PavanPareta11-Apr-07 23:04 
QuestionWM6 emulator vs Device Pin
srinivasan_sundaram2-Apr-07 23:52
srinivasan_sundaram2-Apr-07 23:52 
QuestionProblem with background application Pin
Fernando A. Gomez F.2-Apr-07 10:57
Fernando A. Gomez F.2-Apr-07 10:57 
Questiondll project for smart devices Pin
vvr198330-Mar-07 23:52
vvr198330-Mar-07 23:52 
QuestionWhich process and API run when you open a folder? Pin
nguyenvodich30-Mar-07 0:35
nguyenvodich30-Mar-07 0:35 
Questionissue reading records from SQL CE 2005 Pin
vvr198329-Mar-07 23:17
vvr198329-Mar-07 23:17 
I have written a class for operating the SQLCE database with OLE DB, it work perfect on INSERT ,UPTDATE and so on, but when I use 'select' statement to get values from database it doesn’t return values properly even though the GetNextRows method succeeds.

HRESULT hr = NOERROR;
m_pIRowset = NULL;
m_prghRows = &m_rghRows[0];
hr = pICmdText->SetCommandText(DBGUID_SQL, pwszQuery);
if(!FAILED(hr))
{
hr = pICmdText->Execute(NULL, IID_IRowset, NULL, NULL, (IUnknown **)&m_pIRowset);
if (FAILED(hr)){
AfxMessageBox(_T("failed"));
m_pIRowset = NULL;
}
// Get IColumnsInfo interface
hr = m_pIRowset->QueryInterface(IID_IColumnsInfo, (void**)&m_pIColumnsInfo);
if(FAILED(hr)){
AfxMessageBox(_T("failed"));
}
// Get the column metadata m_ulNumCols//m_pDBColumnInfo
hr = m_pIColumnsInfo->GetColumnInfo(&m_ulNumCols, &m_pDBColumnInfo,&m_pStringsBuffer);
if(FAILED(hr) || 0 == m_ulNumCols){
AfxMessageBox(_T("failed"));
}
// Create a DBBINDING array.
m_dwBindingSize = m_ulNumCols;
m_prgBinding = (DBBINDING*)CoTaskMemAlloc(sizeof(DBBINDING)*m_dwBindingSize);
if (NULL == m_prgBinding){
hr = E_OUTOFMEMORY;
AfxMessageBox(_T("Memory allocation failure"));
}
// Set initial offset for binding position
m_dwOffset = 0;
// Prepare structures to create the accessor
UINT lCount;
ULONG dwOrdinal;
for (lCount = 0; lCount< m_ulNumCols; lCount++)
{
dwOrdinal = m_pDBColumnInfo[lCount].iOrdinal;
m_prgBinding[lCount].iOrdinal = dwOrdinal;
m_prgBinding[lCount].dwPart = DBPART_VALUE | DBPART_STATUS | DBPART_LENGTH;
m_prgBinding[lCount].obLength = m_dwOffset;
m_prgBinding[lCount].obStatus = m_prgBinding[lCount].obLength + sizeof(ULONG);
m_prgBinding[lCount].obValue = m_prgBinding[lCount].obStatus + sizeof(DBSTATUS);
m_prgBinding[lCount].wType = m_pDBColumnInfo[lCount].wType;
m_prgBinding[lCount].pTypeInfo = NULL;
m_prgBinding[lCount].pObject = NULL;
m_prgBinding[lCount].pBindExt = NULL;
m_prgBinding[lCount].dwMemOwner = DBMEMOWNER_CLIENTOWNED;
m_prgBinding[lCount].dwFlags = 0;
m_prgBinding[lCount].bPrecision = m_pDBColumnInfo[lCount].bPrecision;
m_prgBinding[lCount].bScale = m_pDBColumnInfo[lCount].bScale;
switch(m_prgBinding[lCount].wType){
case DBTYPE_WSTR:
m_prgBinding[lCount].cbMaxLen = sizeof(WCHAR)*(m_pDBColumnInfo[lCount].ulColumnSize + 1); // Extra buffer for null terminator
break;
default:
m_prgBinding[lCount].cbMaxLen = m_pDBColumnInfo[lCount].ulColumnSize;
break;
}
// Calculate the offset, and properly align it
m_dwOffset = m_prgBinding[lCount].obValue + m_prgBinding[lCount].cbMaxLen;
m_dwOffset = ROUND_UP(m_dwOffset, 8);
}
// Get IAccessor interface
hr = m_pIRowset->QueryInterface(IID_IAccessor, (void**)&m_pIAccessor);
if(FAILED(hr))
{
AfxMessageBox(_T("failed"));
}
// Create the accessor
//
hr = m_pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, m_dwBindingSize,
m_prgBinding, 0, &m_hAccessor,NULL);
if(FAILED(hr))
{
AfxMessageBox(_T("failed"));
}
// Allocate data buffer.
//
m_pData = (BYTE*)CoTaskMemAlloc(m_dwOffset);
if (NULL == m_pData)
{
hr = E_OUTOFMEMORY;
CString errors;
errors.Format(_T("%d"),m_pDBColumnInfo[2].ulColumnSize);
MessageBox(NULL,errors,NULL,MB_OK);
AfxMessageBox(_T("failed"));
}
// Retrive a row
//
hr = m_pIRowset->GetNextRows(DB_NULL_HCHAPTER, 0, 1, &m_cRowsObtained,&m_prghRows);
if (SUCCEEDED(hr) && hr != DB_S_ENDOFROWSET)
{
// Set data buffer to zero
//
memset(m_pData, 0, m_dwOffset);

// Fetch actual data
hr = m_pIRowset->GetData(m_prghRows[0], m_hAccessor, m_pData);

if (FAILED(hr))
{
m_pIRowset->ReleaseRows(1, m_prghRows, NULL, NULL, NULL);
AfxMessageBox(_T("failed"));
}
}
if (hr == DB_S_ENDOFROWSET)
{
m_bIsEOF = TRUE;
}
}

venkat
Question#error Must define a target architecture Pin
srinivasan_sundaram29-Mar-07 20:42
srinivasan_sundaram29-Mar-07 20:42 
QuestionHve problem with NowSMS Pin
jayu_s_a28-Mar-07 23:31
jayu_s_a28-Mar-07 23:31 
QuestionJavascript error in Blackberry simulator Pin
Vsree28-Mar-07 21:53
Vsree28-Mar-07 21:53 
Question::CommandLineToArgvW in EVC Pin
sheela Rajaram26-Mar-07 20:35
sheela Rajaram26-Mar-07 20:35 
AnswerRe: ::CommandLineToArgvW in EVC Pin
Mike Dimmick1-Apr-07 23:48
Mike Dimmick1-Apr-07 23:48 
Questionrunning sub-query inside sdf file Pin
Blue_Boy26-Mar-07 1:37
Blue_Boy26-Mar-07 1:37 
AnswerRe: running sub-query inside sdf file Pin
Mike Dimmick26-Mar-07 4:05
Mike Dimmick26-Mar-07 4:05 
QuestionLoading file system filter on pocket pc Pin
Pariksheet26-Mar-07 0:28
Pariksheet26-Mar-07 0:28 
Questioninstallation in SmartPhone Pin
a_sklyar23-Mar-07 1:22
a_sklyar23-Mar-07 1:22 
Questioninstallation in a palm PC Pin
iayd22-Mar-07 6:39
iayd22-Mar-07 6:39 
Generalapplication for nokia 7610 Pin
Surjeet Singh Sidhu22-Mar-07 4:08
Surjeet Singh Sidhu22-Mar-07 4:08 
QuestionNeed help with a starting point Pin
dchody21-Mar-07 15:01
dchody21-Mar-07 15:01 
QuestionMultithreading in PocketPC Pin
Bangerman21-Mar-07 9:25
Bangerman21-Mar-07 9:25 
AnswerRe: Multithreading in PocketPC Pin
Mike Dimmick22-Mar-07 2:01
Mike Dimmick22-Mar-07 2:01 
GeneralRe: Multithreading in PocketPC Pin
Bangerman22-Mar-07 21:53
Bangerman22-Mar-07 21:53 
QuestionForce ActiveSync NOT to run Pin
Paul Brower21-Mar-07 2:57
Paul Brower21-Mar-07 2:57 
QuestionLock folder in Win CE? Pin
nguyenvodich20-Mar-07 23:01
nguyenvodich20-Mar-07 23:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.