Re: Query regarding Multiple parameter set using OLEDB
- From: zunilp@xxxxxxxxx
- Date: 30 Apr 2007 03:04:45 -0700
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 -
.
- References:
- Query regarding Multiple parameter set using OLEDB
- From: zunilp
- Re: Query regarding Multiple parameter set using OLEDB
- From: Bob Beauchemin
- Query regarding Multiple parameter set using OLEDB
- Prev by Date: RE: SQLOLEDB always uses Named Pipes
- Next by Date: RE: SQLOLEDB always uses Named Pipes
- Previous by thread: Re: Query regarding Multiple parameter set using OLEDB
- Next by thread: polling a database
- Index(es):
Relevant Pages
|