473,237 Members | 1,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 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 2303

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: TattyMane bigpond.net.au> | last post by:
Hi I am trying to follow the walkthrough on MSDN http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkWalkthroughUpdatingDataUsingDatabaseUpdateQueryInWebForms.asp however, as I do not have...
1
by: Marco Martin | last post by:
Hi, I've got an oledb parameter that I'm sending to an Access DB. The table I'm sending it to has a column called "Zone" of type String that has a default value of "". So I create the...
3
by: bby | last post by:
what's wrong? string SQL="update D_User set Photo=@Photo where ID=@ID"; OleDbCommand myCommand=new OleDbCommand (SQL,connection); OleDbParameter myParm1 =new...
1
by: Steven K | last post by:
Hello, I am calling a SQL Server 2K parameter query with the following: Dim spWebDocGroup As OleDb.OleDbDataReader Dim prmWebDocGroup As OleDbParameter Dim cmdWebDocGroup As New...
2
by: Sagaert Johan | last post by:
Hi I try to use this as sql string ( The field i compare with is variable. ) "SELECT * FROM FMatrix WHERE @wantedfield=@criteria" i use the Parameters.Add with OleDbType.WChar . Why can't...
3
by: Agnes | last post by:
Dim ocmdElem As New OleDbCommand() With ocmdElem .Parameters.Add(New OleDbParameter("@cocode", OleDbType.VarChar, 10, "TEST")) .CommandText = "select loginid from coinfo where code =@cocode "...
1
by: Agnes | last post by:
..Parameters.Add(New OleDbParameter("@cocode", OleDbType.VarChar, 10, UserName)) (A).CommandText = "select 'loginid' from 'coinfo' where 'loginid' = ? " (B).CommandText = "select loginid from...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
0
by: DC | last post by:
I'm getting an error "System.Data.OleDb.OleDbException: No value given for one or more required parameters". I was wondering how do I trace which parameter is not being passed a value in a OleDb...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.