471,327 Members | 2,634 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,327 software developers and data experts.

OledbParameter Collection

Hi All,

If is is not possible to create an instance of OledbParameterCollection
class then how the OledbCommand class is creating an instance of
OledbParameterCollection in it's property "Parameters".

I tried to find the concept behind that but could not sort it out. If
anyone find it for me, it will be a great help.

Thanks,
Biren.

Jan 30 '06 #1
3 2235

"Biren Prajapati" <se*********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi All,

If is is not possible to create an instance of OledbParameterCollection
class then how the OledbCommand class is creating an instance of
OledbParameterCollection in it's property "Parameters".


It's not possible for YOU to create an instance of OledbParameterCollection.
It IS possible for OleDbCommand because it is in the same assembly and there
will be constructor marked as "internal" which means "accessible to anything
in this assembly".

You will find this used a lot in the .NET framework.

I suspect that the reason it is done this way is to reduce the number of
possible breaking changes in subsequent releases however I think that in
this case it would be quite nice to be able to easily reuse parameter
collections and a reasonably common requirement.

You'll just have to put them in a List<OldDbParameter> and write a method to
copy them.

Jan 30 '06 #2
Thanks.........this may be the only reason.......or any other reason
possible?

Jan 30 '06 #3
Hi,
"Biren Prajapati" <se*********@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
Thanks.........this may be the only reason.......or any other reason


Conceptually you can't have a "loose" parameter, one that belongs to no
command. Each parameter should belown to one Command. That's why the
constructor is marked as internal and the only way to create it is through
Command, at the creation time the connection between the Command and the
parameter is established.

I dont remember if you have a pattern name for this. but it's a fairly
common occurence in cases like the above and you will find it all over the
framework.

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Jan 30 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by TattyMane bigpond.net.au> | last post: by
1 post views Thread by Marco Martin | last post: by
3 posts views Thread by bby | last post: by
1 post views Thread by Steven K | last post: by
3 posts views Thread by Agnes | last post: by
1 post views Thread by Agnes | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.