Re: Query regarding Multiple parameter set using OLEDB

Tech-Archive recommends: Fix windows errors by optimizing your registry



HI Bob,
Thanks for your reply.
1. I was not aware of the SQL Server issue. Is it same for new SQLNCLI
provider also?
Because when we tested the same in JDBC(using java API), we found
that SQL 2000 driver working like as mentioned by you, but SQL 2005
driver works in a much better way. Is the same thing with SQLNCLI?
2. I refereed your example as a first reference before posting
this(eventhough it is ATL and mine is direct OleDB interfaces). There
also its an arry of valuse, right?
struct theParms manParms[3] = { {10,10}, {20,20}, {30,30} };
void *pParms = (void *)manParms;

I tried the same thing then call DBPARAMS::pData=pParms ;

Did I miss anything in my understanding?
3. I will check IRowsetFastLoad and let you know the result

Regards
Zunilp


On Apr 28, 10:14 pm, "Bob Beauchemin" <bobb_no_s...@xxxxxxxxxxxxx>
wrote:
HiZunilp,

Although I've not worked there for almost 2 years, you can find an example
(in ATL) at an old webpage of mine
(http://staff.develop.com/bobb/multiparm.zip). Bear in mind that, although
using multiple parameter sets is an optmization in some databases, its not
an optimization in SQL Server, although it is supported. When you use
multiple parameter sets SQL Server still makes one roundtrip to the server
for each set of parameters. For optimizing multiple inserts in code, you'll
have better results using IRowsetFastLoad. There is an IRowsetFastLoad
example in SQL Server books online.

Bob Beauchemin
SQLskillshttp://www.SQLskills.com/blogs/bobb

<zun...@xxxxxxxxx> wrote in message

news:1177760373.922313.132010@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx



Hi,
I am now trying to write a consumer application which uses SQLOLEDB/
SQLNCLI to insert/update/delete data. I wish to send multiple set of
parameters with same sattement(either INSERT/UPDATE).
What I am doing is
1. For the first set of parameter
I call ICommandWithParameters::SetParameterInfo()
I call CreateAccessor
2. For all set of parameters i set the value in a seperate
buffer(Each set is seperate buffer). which is stored in an arry of
pointers
char *paramSetBuffer[1024];
Forb loop for each set of parameter {
char *paramBuffer = (char *)_alloca(paramBufLen* sizeof(char));
paramSetBuffer[pramsetCount] = paramBuffer ;
}

3. Last after setting all, in the DBPARAMS structure
DBPARAMS::pData = paramSetBuffer;
DBPARAMS::cParamSets = <<number of parametersets>>
DBPARAMS:hAccessor = myaccessor;

4. Then call ICommand::Execute passing the DBPARAMS.

But then I get an error saying "Invalid parameter values"
But if I pass DBPARAMS::pData = paramSetBuffer[0];
DBPARAMS::cParamSets =1;
Then the first set of values is Inserted.

My questions
1. How I can pass multiple parameter sets to DBPARAMS::pData ? Can I
pass a array?
2. Shall I have to create accessor each time
3. Shall I have to call setPrameterInfo each time.

Is thee any example on the net which explains this?

Reagrds
zunilp- Hide quoted text -

- Show quoted text -


.



Relevant Pages

  • Re: Query regarding Multiple parameter set using OLEDB
    ... using multiple parameter sets is an optmization in some databases, ... an optimization in SQL Server, ... SQLNCLI to insert/update/delete data. ... in the DBPARAMS structure ...
    (microsoft.public.data.oledb)
  • Re: Zugriff mit VB 6 auf SQLEXPRESS 2005 - DB
    ... ODBC-Verbindung? ... Dann wirds auch ODBC und SQLNCLI nicht richten. ... Der SQLNCLI Treiber kann direkt als ADO Provider ... das muss zuvor über die SQL Server ...
    (microsoft.public.de.sqlserver)
  • Re: DBExpress in DeXter
    ... SQLNCLI is not part of MDAC its part of SQL Server, ... Not needed from a client perspective. ...
    (borland.public.delphi.non-technical)
  • Re: OLEDB error with SQL 2005
    ... Same problem with SQLNCLI or with SQLOLEDB. ... is to pass all string as empty string instead of setting status flag to ... Source:Microsoft OLE DB Provider for SQL Server ... Books Online for SQL Server 2005 at ...
    (microsoft.public.data.oledb)
  • SQL Server 2005 Native Client
    ... What would be the best data access client for SQL Server 2005 that support ... low-level components that need high performance. ... The SQLNCLI is a native, ...
    (microsoft.public.sqlserver.clients)