Saturday, February 25, 2012

c++ ole DB stack overflow during sql server compilation

hi,
when i execute :
CCommand<CManualAccessor, CBulkRowset, CNoMultipleResults> rs;
rs.SetRows(100);
HRESULT code_resultat = rs.Open(session, requete, &propset, NULL,
DBGUID_DBSQL, FALSE);

with a requete with length = 13000, it works perfectly
but when my requete length is 200000 (example : SELECT * FROM myTABLE
WHERE id_table IN("lot of number : more then 30000 number"))
i have code_resultat = DB_E_ERRORSINCOMMAND (= 0x80040e14)
and when i explore the IErrorInfo message, i have :
minor = 565 and the message is
source :Microsoft OLE DB Provider for SQL Server
serveur has made a stack overflow during compilation...

Is there a solution to extract to data ?
in a fast way ...

thanks in advance ...
Mike[posted and mailed, please reply in news]

michael (mmike74@.caramail.com) writes:
> when i execute :
> CCommand<CManualAccessor, CBulkRowset, CNoMultipleResults> rs;
> rs.SetRows(100);
> HRESULT code_resultat = rs.Open(session, requete, &propset, NULL,
> DBGUID_DBSQL, FALSE);
> with a requete with length = 13000, it works perfectly
> but when my requete length is 200000 (example : SELECT * FROM myTABLE
> WHERE id_table IN("lot of number : more then 30000 number"))
> i have code_resultat = DB_E_ERRORSINCOMMAND (= 0x80040e14)
> and when i explore the IErrorInfo message, i have :
> minor = 565 and the message is
> source :Microsoft OLE DB Provider for SQL Server
> serveur has made a stack overflow during compilation...

That sounds like there is a bug or limitation somewhere.

Anyway, SQL Server does not perform well with very long IN clauses.
It could take over 15 seconds just to compile that query.

Take a look at http://www.sommarskog.se/arrays-in-sql.html for alternative
methods to pose the query.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

c++ lib

i am looking for c++ libs so that i may connect to sqlserver..(user does not
have client sql installed)
thanks
Hi
Look at
http://msdn.microsoft.com/library/de...asp?frame=true
Current Windows installations come with MDAC installed so you have the OLE
DB libraries.
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Abe" <abe_icm@.verizon.net> wrote in message
news:bXAdf.2224$Pa4.1266@.trndny01...
>i am looking for c++ libs so that i may connect to sqlserver..(user does
>not have client sql installed)
> thanks
>

c++ lib

i am looking for c++ libs so that i may connect to sqlserver..(user does not
have client sql installed)
thanksHi
Look at
http://msdn.microsoft.com/library/d...asp?frame=true
Current Windows installations come with MDAC installed so you have the OLE
DB libraries.
--
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Abe" <abe_icm@.verizon.net> wrote in message
news:bXAdf.2224$Pa4.1266@.trndny01...
>i am looking for c++ libs so that i may connect to sqlserver..(user does
>not have client sql installed)
> thanks
>

C++ code sample for working with Inegration Service

Hi All,

Are there samples for working with Inegration Service ?

As I see in shipped samples are C# and VB only.

Particulary I need a C++ code for "Enumerating Available Packages Programmatically"

Thanks a lot.

Sergiy

The code is very similar to C# code, except that instead of using C# classes you should use COM interfaces, declared in DTS.H (from C:\Program Files\Microsoft SQL Server\90\SDK\Include).
Here is some code to get you started (I've skipped any error checking for clarity):

#include "dts.h"

void EnumPackages()
{
CComPtr<IDTSApplication90> app;
CComPtr<IDTSPackageInfos90> pkgInfos;

app.CoCreateInstance(__uuidof(Application));
app->GetDtsServerPackageInfos(CComBSTR(L"File System"), CComBSTR(L"."), &pkgInfos);

LONG count;
pkgInfos->get_Count(&count);

printf("found %d packages", count);
}

int _tmain(int argc, _TCHAR* argv[])
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);

EnumPackages();

CoUninitialize();
return 0;
}

If you like VC build-in COM support classes, you may #import <dts.tlb> instead of #include <dts.h> - this gives you better wrappers and HRESULT-to-exception translation.

|||

HiMichael,

Thanks a lot for answer. It really help.

Sergiy

C++ code sample for working with Inegration Service

Hi All,

Are there samples for working with Inegration Service ?

As I see in shipped samples are C# and VB only.

Particulary I need a C++ code for "Enumerating Available Packages Programmatically"

Thanks a lot.

Sergiy

The code is very similar to C# code, except that instead of using C# classes you should use COM interfaces, declared in DTS.H (from C:\Program Files\Microsoft SQL Server\90\SDK\Include).
Here is some code to get you started (I've skipped any error checking for clarity):

#include "dts.h"

void EnumPackages()
{
CComPtr<IDTSApplication90> app;
CComPtr<IDTSPackageInfos90> pkgInfos;

app.CoCreateInstance(__uuidof(Application));
app->GetDtsServerPackageInfos(CComBSTR(L"File System"), CComBSTR(L"."), &pkgInfos);

LONG count;
pkgInfos->get_Count(&count);

printf("found %d packages", count);
}

int _tmain(int argc, _TCHAR* argv[])
{
CoInitializeEx(NULL, COINIT_MULTITHREADED);

EnumPackages();

CoUninitialize();
return 0;
}

If you like VC build-in COM support classes, you may #import <dts.tlb> instead of #include <dts.h> - this gives you better wrappers and HRESULT-to-exception translation.

|||

Hi Michael,

Thanks a lot for answer. It really help.

Sergiy

C++ and SQL Server programming

Are there any good resources (books, websites, etc) for programming SQL
Server using Visual C++? I am currently using C# but I really want to learn
how to do it using C++, but it appears to be much more difficult using C++.

ThanksHi

It depends on what you are using to interface with the database, with SQL
Server there are quite a few C++ examples check out samples in the index of
Books Online. Also there are others on MSDN e.g
http://support.microsoft.com/?kbid=184968&sd=msdn from
http://msdn.microsoft.com/visualc/d...es/default.aspx

It may be worth avoiding DB Library and Embeded SQL for C as this has
started to be deprecated in SQL 2005.

John

"Brooke" <tbrooked@.hotmail.com> wrote in message
news:Qgirf.12123$g_6.9870@.tornado.texas.rr.com...
> Are there any good resources (books, websites, etc) for programming SQL
> Server using Visual C++? I am currently using C# but I really want to
> learn how to do it using C++, but it appears to be much more difficult
> using C++.
> Thanks|||John Bell (jbellnewsposts@.hotmail.com) writes:
> It may be worth avoiding DB Library and Embeded SQL for C as this has
> started to be deprecated in SQL 2005.

Actually, it have been deprecated for longer than so. With these interfaces
you don't have full support for features added to SQL7 and SQL 2000.

The best interface for C++ programming is probably ODBC. OLE DB is an
alternative, but it's more cumbersome to use, no matter if you use the
raw interface or the consumer templates.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

C++ .net data binding

I have a datagrid control bound to a dataview of a table in a dataset.
I am using a tablestyle to control which of the table columns are
displayed in the datagrid. When any cell in a row is selected I want to
select and highlight the entire row.
By catching the mousedown event and using HitTest I can work out what
row was clicked on the control and set the selected row but I can
highlight the row.
Can anyone tell me where I am going wrong ?"Jez" <jezario@.hotmail.co.uk> wrote in message
news:1129131568.948426.123380@.g14g2000cwa.googlegroups.com...
>I have a datagrid control bound to a dataview of a table in a dataset.
> I am using a tablestyle to control which of the table columns are
> displayed in the datagrid. When any cell in a row is selected I want to
> select and highlight the entire row.
> By catching the mousedown event and using HitTest I can work out what
> row was clicked on the control and set the selected row but I can
> highlight the row.

> Can anyone tell me where I am going wrong ?
Posting in the wrong newsgroup. :-)