|
Are the values in the exact sequence of the index? Does Supports(adIndex) say that this is supported?
Regards,
João Paulo
|
|
|
|
|
adIndex is supported, values correspond to the key sequence,
i call ->put_index(bstr IndexName)
and Seek() works fine with one column index, but with more keyvalues returns hr = -2147024809(The parameter is incorrect), although the same code workes fine on Desktop.
Is there any difference in using Seek() on one or more indexed columns?
wefergrtgrtvrtrt rtrtb brt
|
|
|
|
|
georgeivanov wrote:
Is there any difference in using Seek() on one or more indexed columns?
I really don't know... If I come up with something, I'll let you know.
Regards,
João Paulo
|
|
|
|
|
OK, i found the answer in another forum:
http://www.developersdex.com/sql/message.asp?r=3502937&p=2495
wefergrtgrtvrtrt rtrtb brt
|
|
|
|
|
I noticed that when I'm trying to read or even use in query column which is on position over 32 I got an error... exactly it seems like when I use GetFieldValue function with column over 32 position, I recaive always 32 column value, and when I use such column in query for Open funcion it throws an exception. Is there any solution for that? I hope I don't need to change database structure... the table I'm using has 68 columns, and becasue it's comming from working PC application, there will be real problem to rearange it. So just before I start cuting it to 32, I hope got a confirmation that this is only way... or hope any advice how to access column position over 32...
Radek
|
|
|
|
|
Ehm...I'm sorry... I think before I checked not enough... maybe jsut this problem with reading was temporary, because now it seems to work again... but still have problem with query... but now my guess is that the problem is because of null value in long type column... is there cuch kind of limit in AdoCE?
|
|
|
|
|
I think I found solution myself... or maybe just the real reason of my problem... it seems like it is not allowed to use "=" with double vales in sql query... when I changed NUM=2 to (NUM>1 AND NUM<3) eveything works fine...
Radek
|
|
|
|
|
I have a problem with runing the sample project. When I compile it (changed #import to adoce31.dll on my computer) and run I can see an message:
First-chance exception in AdoSample.exe: 0xC0000005: Access Violation
It appear during
hr = m_pConnection->Open(_bstr_t(m_strConnection), _bstr_t(lpstrUserID), _bstr_t(lpstrPassword), NULL);
but when i checked it step by step I noticed that first error is in
m_pConnection.CreateInstance(__uuidof(Connection));
exactly during
hr = CoCreateInstance(rclsid, pOuter, dwClsContext, __uuidof(IUnknown), reinterpret_cast<void**>(&pIUnknown));
Result of this function is -2147221164.
What should I do to fix it? I guess that problem appear because of lack of any dll on my PocketPC or maybe wrong version? But I'm beginer in WindwsCE programing and have really no idea what i should install or do.
Thank you in advanve for any help.
Radek
|
|
|
|
|
Did you install ADOCE 3.1 in your machine? There are a number of DLLs that need to be there. Here is the install script I use to deliver ADOCE 3.1:
[Version]
Signature = "$Windows NT$"
Provider = "Microsoft"
CESignature = "$Windows CE$"
[CEStrings]
AppName="ADO CE 3.1"
CompanyName="PrimeWorks"
InstallDir=%CE1%
[Strings]
;sh3_cpu= 10003
;sh4_cpu = 10005
;mips_cpu = 4000
strongarm_cpu = 2577
;armcpu = 1824
reg_path = Software\%CompanyName%\%AppName%
[CEDevice]
UnsupportedPlatforms = "Jupiter","HPC" ; Does not support pltfrm1
VersionMin = 3.0
VersionMax = 3.01
[CEDevice.SA]
ProcessorType = %strongarm_cpu%
[DefaultInstall]
CopyFiles = Files.Shared
CEShortcuts = Shortcuts
CESelfRegister = adoce31.dll, adosync.dll, msdadc.dll, msdaer.dll, msdaosp.dll, adoxce31.dll
[SourceDisksNames]
1 = ,"Common files",,Common
[SourceDisksNames.ARM]
2 = ,"ARM files",,ARMRel
[SourceDisksNames.MIPS]
2 = ,"MIPS files",,MIPSRel
[SourceDisksNames.SA]
2 = ,"ARM files",,SA_Files
[SourceDisksNames.SH3]
2 = ,"SH3 files",,sh3Rel
[SourceDisksFiles]
msdaerpt.dll = 2
adocedb31.dll = 2
adoceoledb31.dll = 2
adosync.dll = 2
adosyncstub.dll = 2
adoxce31.dll = 2
msdadc.dll = 2
msdaer.dll = 2
msdaeren.dll = 2
adoce31.dll = 2
msdaosp.dll = 2
[DestinationDirs]
;Files.Application = 0,%InstallDir%
Files.Shared = 0,%CE2% ;\Windows
Shortcuts = 0,%CE2%\Help ;\Windows\Help
[Files.Application]
[Files.Shared]
"msdaerpt.dll",,,0x00000001
"adocedb31.dll",,,0x00000001
"adoceoledb31.dll",,,0x00000001
"adosync.dll",,,0x00000001
"adosyncstub.dll",,,0x00000001
"adoxce31.dll",,,0x00000001
"msdadc.dll",,,0x00000001
"msdaer.dll",,,0x00000001
"msdaeren.dll",,,0x00000001
"adoce31.dll",,,0x00000001
"msdaosp.dll",,,0x00000001
[Shortcuts]
Most of this is boilerplate, but you can see what is needed and what needs to be registered. Check the help file.
Regards,
João Paulo
|
|
|
|
|
First of all thank you very much for your answer, I never expected it so fast. It helped me a lot, the problem was that before I only copied, not registered necessery dll. So now, I registered them (following information from you script) and everything work fine. Once again THANK YOU!
Radek
|
|
|
|
|
How do you run this install script?
|
|
|
|
|
Check the documentation on creating install scripts. Is too much to explain here.
Regards,
João Paulo
|
|
|
|
|
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace, rename ( "EOF", "adoEOF" ) raw_interfaces_only
Provider = "Microsoft.SQLSERVER.OLEDB.CE.2.0"
Device: Jornada720/690/680;
ARE AddNew(),Delete() methods of Recordset Object supported?
because Support() methods returns TRUE, but executing them returns HRESULT = --2146825037 (ADO Error: The operation requested is not supported by the provider.)
wefergrtgrtvrtrt rtrtb brt
|
|
|
|
|
How did you open the recordset? Some open options make the recordset read-only, so AddNew and Update might not be supported for that particular recordset.
Regards,
João Paulo
|
|
|
|
|
recordset is opened with parameters: adOpenDynamic, adLockPessimistic adCmdUnknown but the result is the same. Is it possible the Support() methot to return TRUE for adAddNew, adDelete but somehow these methods not be suppored?
|
|
|
|
|
The #import directive is wrong. It should point to your eVC's libraries directory and mention adoce31.dll .
Regards,
João Paulo
|
|
|
|
|
#import "C:\Windows CE Tools\wce300\hpc2000\dataaccess\arm\adoce31.dll" no_namespace, rename ( "EOF", "adoEOF" ) raw_interfaces_only
Provider = "Microsoft.SQLSERVER.OLEDB.CE.2.0"
Database: Data.sdf
Device: Jornada720/690/680;
m_pRecordset->Open(_T("SELECT * FROM Table"), _variant_t(m_pRecordset.GetInterfacePtr()), adOpenDynamic, adLockOptimistic , adCmdText);
while(!m_pRecordset.EndOfFile())
{
hr = m_pRecordset->MoveFirst();
hr = m_pRecordset->Delete(1);
// still hr = -2146825037 (ADO Error: The operation requested is not supported by the provider.) althought Support() returns TRUE!!!!.
}
wefergrtgrtvrtrt rtrtb brt
|
|
|
|
|
Please read the article code. That is NOT the way to add rows to a recordset in ADOCE. You have to open the table in direct mode. Only then will you be able to use AddNew. Check this code snippet:
bOk = rs.Open(_T("Author"), CADORecordset::openTable);
if(bOk)
{
if(!rs.AddNew())
{
MessageBox(_T("AddNew failed."),
_T("Error"), MB_OK | MB_ICONSTOP);
return FALSE;
}
}
...
if(bOk)
{
rs.SetFieldValue(_T("authID"), page.m_nAuthorID );
rs.SetFieldValue(_T("authName"), page.m_strAuthorName);
rs.SetFieldValue(_T("authDate"), page.m_odtAuthorDate);
bOk = rs.Update();
if(!bOk)
MessageBox(_T("Update failed"),
_T("Error"), MB_OK | MB_ICONSTOP);
}
That's the way to go!
Regards,
João Paulo
|
|
|
|
|
OK,thanks. I tried exactly your source code - it works perfect with *.cdb file and CEDB Provider
(
BSTR Provider;
m_pConnection->get_Provider(&provider);
//Provider = "CEDB";
)
but when I change provider - "Microsoft.SQLSERVER.OLEDB.CE.2.0" and tried with *.sdf database (SQL Server CE) these methods fail. So i come into conclusion they are not supported by this provider. I only wonder why Support() method returns they are supported. Am I using wrong provider or they really are not supported, which is strange exactly for Delete() method.
wefergrtgrtvrtrt rtrtb brt
|
|
|
|
|
OK, thanks. I tried exactly your source code - it works perfect with *.cdb file and CEDB Provider
( BSTR Provider;
m_pConnection->get_Provider(&provider);
//Provider = "CEDB";
)
but when I change provider - "Microsoft.SQLSERVER.OLEDB.CE.2.0" and tried with *.sdf database (SQL Server CE) these methods fail. So i come into conclusion they are not supported by this Provider. I only wonder why Support() method returns they are supported. Am I using wrong provider or really they aren't supported, which is strange exactly for the Delete() method.
wefergrtgrtvrtrt rtrtb brt
|
|
|
|
|
Try this: go to ado.cpp and replace the line 244 with this:
hr = m_pRecordset->Open((LPCTSTR)m_strQuery, _variant_t((IDispatch*)mpdb, TRUE), adOpenDynamic, adLockOptimistic, adCmdTableDirect);
Regards,
João Paulo
|
|
|
|
|
OK, it worked! Thanks!
wefergrtgrtvrtrt rtrtb brt
|
|
|
|
|
Is it possible to compile the sample project using "Use MFC in a Static Library" option?
|
|
|
|
|
Although I did not test it, I believe you should have no problems with it. The "MFC in a static library" option will only change the way the external MFC linkage is done, not the way the ADOCE COM objects are referenced or instantiated.
Regards,
João Paulo
|
|
|
|
|
I tried to compile the example using 'Win32 (WCE x86) Release' option, using the 'Visual Tools,' and it did not compile. Such errors as "'dt' uses undefined class 'COleDateTime'", etc. occured. It seems that my compiler(or linker) cannot find needed library or something else.
|
|
|
|
|