|
Hi all,
I am a newbie to SQLCE development . I am using embedded VC++ 3.0 with SQLCE 2.0 on PocketpC 2002 emulator. I am using IRowset and other associated interfaces for fetching records and iterating the rowset from SQLCE .sdf file. It works fine only for 2 to 3 times only. The application hangs when the processrowset method is invoked for repeated no. of times. The error caused is "Not enough storage space to perform this command" . This error occurs at the ICommandText:: Execute method. Following is the processrowset method used. Please help. Very urgent. Thanks in advance, Mallee
void CMyDB::ProcessRowset(int nSkipRecordsValue)
{
HRESULT hr = NOERROR;
LVITEM pitem;
long idx=0;
long lTotalRows = 0;
static long lTotalCols = 0;
long t1=0;
long t2=0;
long elapse=0;
ULONG lColumn = 0;
ULONG lNumCols = 0;
ULONG lCount = 0;
ULONG lNumRowsRetrieved = 0;
ULONG ConsumerBufColOffset = 0;
IAccessor *pIAccessor = NULL;
IColumnsInfo *pIColumnsInfo = NULL;
DBCOLUMNINFO *pDBColumnInfo = NULL;
DBBINDING *pBindings = NULL;
HACCESSOR hAccessor = NULL;
HROW hRows[100];
HROW *pRows = &hRows[0];
BYTE *pBuffer = NULL;
WCHAR *pStringsBuffer = NULL;
CStringArray szFields;
int intIndex=0;
t1 = GetTickCount();
//arrCustom1->RemoveAll();
// Obtain access to the IColumnInfo interface, from the Rowset object.
hr = m_pIRowset->QueryInterface(IID_IColumnsInfo,
(void **)&pIColumnsInfo);
if(FAILED(hr)) {
AfxMessageBox(_T("Failed to query IColumnsInfo interface!"));
}
else {
m_pIRowset->AddRef();
}
// Retrieve the column information.
pIColumnsInfo->GetColumnInfo(&lNumCols,
&pDBColumnInfo,
&pStringsBuffer);
// Free the column information interface.
pIColumnsInfo->Release();
// Create a DBBINDING array.
pBindings = new DBBINDING[lNumCols];
// Using the ColumnInfo structure, fill out the pBindings array.
for(lCount=0; lCount<lnumcols; lcount++)="" {
="" pbindings[lcount].iordinal="lCount+1;
" pbindings[lcount].obvalue="ConsumerBufColOffset;
" pbindings[lcount].ptypeinfo="NULL;
" pbindings[lcount].pobject="NULL;
" pbindings[lcount].pbindext="NULL;
" pbindings[lcount].dwpart="DBPART_VALUE;
" pbindings[lcount].dwmemowner="DBMEMOWNER_CLIENTOWNED;
" pbindings[lcount].eparamio="DBPARAMIO_NOTPARAM;
" pbindings[lcount].cbmaxlen="48;
" pbindings[lcount].dwflags="0;
" pbindings[lcount].wtype="DBTYPE_WSTR;
" pbindings[lcount].bprecision="pDBColumnInfo[lCount].bPrecision;
" pbindings[lcount].bscale="pDBColumnInfo[lCount].bScale;
" consumerbufcoloffset="" +="48;" pdbcolumninfo[lcount].ulcolumnsize;
="" }
=""
="" get="" the="" iaccessor="" interface.
="" hr="m_pIRowset-">QueryInterface(IID_IAccessor,
(void **)&pIAccessor);
// Validation
if(FAILED(hr)) {
AfxMessageBox(_T("Failed to query IAccessor interface!"));
}
else
m_pIRowset->AddRef();
// Create an accessor from the set of bindings (pBindings).
pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA,
lNumCols,
pBindings,
0,
&hAccessor,
NULL);
lTotalCols = lNumCols;
// Get a record
m_pIRowset->GetNextRows(NULL,
0,
0,
&lNumRowsRetrieved,
&pRows);
// Allocate space for the row buffer.
pBuffer = new BYTE[ConsumerBufColOffset];
// Display the rows.
while(lNumRowsRetrieved > 0)
{
//For each row, print the column data.
for(lCount=0; lCount<lnumrowsretrieved; lcount++)="" {
=""
="" initialize...
="" memset(pbuffer,="" 0,="" consumerbufcoloffset);
="" get="" the="" row="" data="" values.
="" m_pirowset-="">GetData(hRows[lCount], hAccessor, pBuffer);
// -- Item
pitem.mask = LVIF_TEXT;
pitem.pszText = (LPTSTR)&pBuffer[pBindings[0].obValue];
pitem.iSubItem = 0;
//AfxMessageBox(pitem.pszText);
CString mFieldValue = pitem.pszText;
//arrCustom1->SetAt(intIndex++,mFieldValue);
arrCustom1->Add(mFieldValue);
}
// Release the rows retrieved.
// Release the rows retrieved.
m_pIRowset->ReleaseRows(lNumRowsRetrieved,
hRows,
NULL,
NULL,
NULL);
// Get the next set of 10 rows.
m_pIRowset->GetNextRows(NULL,
0,
0,
&lNumRowsRetrieved,
&pRows);
};
hr = S_OK;
if (NULL != pBuffer) {
CoTaskMemFree(pBuffer);
//pBuffer = NULL;
}
if (NULL != pIColumnsInfo) {
CoTaskMemFree(pIColumnsInfo);
pIColumnsInfo = NULL;
}
if (NULL != pBindings) {
CoTaskMemFree(pBindings);
pBindings = NULL;
}
pIAccessor->ReleaseAccessor(hAccessor,NULL);
pIAccessor->Release();
if (NULL != pIAccessor) {
CoTaskMemFree(pIAccessor);
pIAccessor = NULL;
}
if (NULL != m_pIRowset) {
CoTaskMemFree(m_pIRowset);
m_pIRowset = NULL;
}
return ;
}
|
|
|
|
|
I'm trying to port some ADO db code for use on PocketPC 2003. Is there a definitive explanation about what you need to do to make this a viable effort?
I have a machine with EVC3 installed, and was trying to use Joao's article, and it was importing the adoce31.tlb file, but I can't seem to find that file on my evc3 installation anywhere.
Thanks in advance.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Instead of adoce31.tlb, use adoce31.dll - it has all the type library info you need.
Regards,
João Paulo Figueira
Embedded MVP
|
|
|
|
|
Well, I tried that, and the compiler is complaining about _NewEnum. Here are the error messages:
<br />
adoce31.tlh(372) : error C2146: syntax error : missing ';' before identifier '_NewEnum'<br />
adoce31.tlh(372) : error C2501: 'IUnknownPtr' : missing storage-class or type specifiers<br />
adoce31.tli(16) : error C2065: '_com_issue_errorex' : undeclared identifier<br />
adoce31.tli(340) : error C2143: syntax error : missing ';' before 'tag::id'<br />
adoce31.tli(340) : error C2433: 'IUnknownPtr' : 'inline' not permitted on data declarations<br />
adoce31.tli(340) : error C2501: 'IUnknownPtr' : missing storage-class or type specifiers<br />
adoce31.tli(340) : fatal error C1004: unexpected end of file found<br />
Am I missing a step?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Here's how I do it:
#include <wceatl.h>
#include <comdef.h>
_COM_SMARTPTR_TYPEDEF(IUnknown, __uuidof(IUnknown));
void __stdcall _com_issue_error(HRESULT m_hr);
void __stdcall _com_issue_errorex(HRESULT hr, IUnknown *pUnkn, REFIID riid);
#import "C:\Windows CE Tools\wce300\Pocket PC 2002\dataaccess31\target\arm\adoce31.dll" rename_namespace("ADO") rename("EOF", "EndOfFile")
using namespace ADO;
You will have to define your own error handler in _com_issue_errorex .
Regards,
João Paulo Figueira
Embedded MVP
|
|
|
|
|
Many thanks, that cleared up that particular set of issues. Now, I'm in a proprietary file form of hell. If I find my way out, I'll let you know.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all,
I want to write the data to COM Port using embeddedVC++ 4.0 .But nothing comes on COM port, code is as follows.
If i debug the application it shows COM port is opened successfully,number of Bytes written is also correct
Do i need to do some settings in emulator to make it connect to com port??
same code works fine in VC++6.0.
////
wchar_t rightString[80];
wcscpy(rightString,_T("Hello"));
DCB m_DCB;
m_DCB.DCBlength = sizeof(m_DCB);
m_DCB.BaudRate = 9600;
m_DCB.ByteSize = 8;
m_DCB.fBinary = TRUE;
m_DCB.Parity = NOPARITY;
m_DCB.StopBits = ONESTOPBIT;
m_DCB.fParity = TRUE;
m_DCB.fNull = FALSE;
m_DCB.XonChar = 0x11;
m_DCB.XoffChar = 0x13;
m_DCB.XonLim = 80;
m_DCB.XoffLim = 200;
m_DCB.fAbortOnError = TRUE;
m_DCB.fOutX = false;
m_DCB.fInX = false;
HANDLE m_hPort = CreateFile(_T("COM1:"), GENERIC_READ |
GENERIC_WRITE, 0,NULL, OPEN_EXISTING, 0, NULL);
SetCommState(m_hPort,&m_DCB);
if(m_hPort == NULL)
AfxMessageBox(_T("Can not open port"));
else
if(WriteFile(m_hPort, rightString, 10, &BytesWritten, NULL))
AfxMessageBox(_T("Successfully written"));
CloseHandle(m_hPort);
///
Thanks in Advance
Tushar Mahajan
|
|
|
|
|
HI
My experience is that the emulators do not connect to the COM ports, you must test on a real device. Make sure you get a device that supports RS232 serial connections !! I found out the hard way that some do not ! Dell Axim X5 does and the HP IPAQ 4000 series and above should also.
G. Weideman
|
|
|
|
|
HI,
I use the OLEDB method to seek the record:
...
TableID.eKind = DBKIND_NAME;
TableID.uName.pwszName = (WCHAR*)TABLE_TBL1;
IndexID.eKind = DBKIND_NAME;
IndexID.uName.pwszName = L"idx_Key";
...
// Set the Fld1 and Fld2 data to the pData
//
...
// Seek for the first row where the value of the selected column
// is dwEmployeeID.
hr = pIRowsetIndex->Seek(hAccessor, 1, pData, DBSEEK_FIRSTEQ);
if(FAILED(hr))
{
goto Exit;
}
However the Seek function does not working properly.
....
From the calling palce the client will pass like index, value1, value 2 and value3...based on it i need to seek and get the data.
Anyone know how to seek using composite index?
Thanks
AKS
|
|
|
|
|
Hi all,
I need to write application in Pocket PC. It is about using showing video on screen from web cam. I had free the buffer, but the "out of memory" dialog still pop up after 2 minutes....
unsigned char *pbuffer=(unsigned char *)malloc(m_Width * m_Height*6);
unsigned char *rpbuffer=(unsigned char *)malloc(m_Width * m_Height*6);
//this is allocation of memory
free(pbuffer);
pbuffer = NULL;
free(rpbuffer);
rpbuffer = NULL;
//this is the code of free memory
please help.......................
p.s. I am using eVC++ 4.0 on PPC 2003....
|
|
|
|
|
I use embedded visual c++ to write a video cam software, so that the pocket PC show the screen of the cam. But my menubar does not work.(I tick the top up box) When I click the top up button in menubar, the menubar hangs. But the screen still can show the video.
void CGroup7Dlg::OnPreview()
{
unsigned char *pbuffer = (unsigned char *)malloc(m_PrvWidth * m_PrvHeight * 3);
unsigned char *rpbuffer = (unsigned char *)malloc(m_PrvWidth * m_PrvHeight * 3);
if ((PreviewFrame((unsigned char*) pbuffer)) == false)
AfxMessageBox(_T("Preview Frame Fail!"), MB_OK);
Rectify(pbuffer, rpbuffer); //<----- a
CBitmap bitmap;
bitmap.CreateBitmap(m_PrvWidth, m_PrvHeight, 1, 24, rpbuffer);
CVOImage image;
RECT pic_rect;
m_picture_window.GetWindowRect(&pic_rect);
HDC picDC = ::GetDC(m_picture_window.m_hWnd );
CString path_fname;
::WriteBitmapIntoJpegFile(TEXT("\\pic1.jpg"), 80, (HBITMAP)bitmap);
UpdateData(true);
path_fname ="\\My Documents\\pic1.jpg";
image.Load (picDC ,path_fname );
image.Draw (picDC ,2,13 );
free(pbuffer);
pbuffer = NULL;
free(rpbuffer); //<-------b
rpbuffer = NULL;
}
There will be out of memory if I comment out line b but menubar works. There will be no problem but the screen pixel is in wrong order of course. I don't know how to fix this bug. Please help...
|
|
|
|
|
Developing apps for PPC2003 using EVC++ 4.0...
What happened to the old emulator. The 4.2 emulator doesn't resemble a PDA at all.
Is there a way to get the old emulator? Will it work?
Thanks in advance.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Are you targeting the POCKETPC 2003 or the STANDARDSDK? The PPC 2003 emulator rocks!
Regards,
João Paulo Figueira
Embedded MVP
|
|
|
|
|
Well, it's set to standardsdk_420, but I haven't found a way to change it, and I didn't see anything during install about pocketpc2003...
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
|
Many thanks. You gotta wonder why MS doesn't just include that on the freakin DVD...
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hi all,
I'm trying to programmatically remove or disable the Remove Programs options in start->settings.
A lot of the settings are contained in registry keys which I can disable but Remove Programs doesn't seem to be.. I was thinking about either removing whatever it is, or writing a stub program to overwrite it on the installation of my software.
Either way, does anyone know where/what it is? Is it an executable or a key or what?
Thanks!
Kelly Ryan
|
|
|
|
|
Hi all~
How to add tag pages which place on the top of the tag control?
Also, can the location of the tag control not be started at the top corner(0,0) of the form? I cannot change the location. It changes back to (0,0) if I change it.
thanks~
|
|
|
|
|
If you find code warrior , J2me or Visual Studio are too complicated and you feel that you need to learn just one tool that is a lot easier, instead of three then, look up the Mobile Application development tool called GoDb which is similar to VB in look and feel but allows you to create Powerful Mobile Applications for PALM, POCKET PC, Symbian , Nokia. The tool comes with it own IDE , Gbasic - a language similar to VB ( infact if you know VB you can start programming in it instantly) and Simulators and Sync server .
|
|
|
|
|
Hi,
Is there any way to put the main menu & toolbar on the top of the Form in C#?
Thanks.
|
|
|
|
|
Hi,
How can i write new language for PPC ?!!!
What i want to do is Adding new language keyboard to WinCE ...
Please introduce to me some links about it.
Regards,
Hadi
|
|
|
|
|
Read Doug Boling's book on Windows CE development. It has some sample code on how to write a new keybaord.
Regards,
João Paulo Figueira
Embedded MVP
|
|
|
|
|
Thanks a lot
|
|
|
|
|
I am student of Aptech and this days i am doing a project on .Net. In this project i am tryiny to creat Mobile application where i am tryiny do that user access my application by mobile and he can select one ringtone after that he or she can install that bell on his or her mobile just like mobile compnies do on there web site. So tell me is that possible if possible then tell me how i nead your help pleaszzzzzzzzz help me i am wating for your replay
Masood Lodhi
Masood Lodhi
|
|
|
|
|
Hi all,
is dynamic loading of appDomains also work in compact framework .net ?
I have run example in dynamic loading in .net framework,
but since compact framework dont have AppDomainSetup Class,
so what can I do ?
The code in dynamic loading in .net framework is in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp05162002.asp
but when the port the code to compact framework, the code doesn't work coz AppDomainSetup Class is missing in .net CF.
Can anyone point to sample code or articles on it ?
Thanks
|
|
|
|
|