473,750 Members | 2,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing a parameter Collection

I want to create a generic data layer that uses Oracle as the back end. By
generic, I just want a couple of procedures. All access will be done with
stored procs, and I want one that returns a dataset and one that returns a
datareader. I want to pass in the commandName, and a ParameterArray that
holds the parameters I want to populate:

Public Shared Function ExeCmd(ByVal CommandName As String, ByVal CmdParam as
OracleParameter Collection) as DataSet
Using z as new OracleCommand
with x
.CommandType = StoredProc
.CommandText = CommandName

'I want to iterate through the parameter collection and add
each parameter here
end with

End Using

End Function

How can I apply the ParameterCollec tion to the command?

John


Jun 20 '06 #1
1 3937

John Wright wrote:
I want to create a generic data layer that uses Oracle as the back end. By
generic, I just want a couple of procedures. All access will be done with
stored procs, and I want one that returns a dataset and one that returns a
datareader. I want to pass in the commandName, and a ParameterArray that
holds the parameters I want to populate:

Public Shared Function ExeCmd(ByVal CommandName As String, ByVal CmdParam as
OracleParameter Collection) as DataSet
Using z as new OracleCommand
with x
.CommandType = StoredProc
.CommandText = CommandName

'I want to iterate through the parameter collection and add
each parameter here
end with

End Using

End Function

How can I apply the ParameterCollec tion to the command?

John


I'm not sure how to do it in Oracle, but here's what i do for DB2.

Public Function Execute_Command (ByVal Command As DB2Command, ByVal
Parameters() As DB2Parameter, ByVal With_Return As Boolean) As
DB2DataReader

Dim Parameter As DB2Parameter

If Not Parameters Is Nothing Then

For Each Parameter In Parameters

' Only add it if something is actually there.
If Not Parameter Is Nothing Then
Command.Paramet ers.Add(Paramet er)

Next Parameter

End If ' Not Parameters Is Nothing

' The command is ready. so, execute it, and grab the output, if
any.
' The information cannot be controlled by this statement, so
catch errors.
Try

If With_Return Then

Return Command.Execute Reader

Else

Command.Execute NonQuery()

End If

Catch The_Exception As Exception

Report_error(Th e_Exception)

End Try

End Function

B.

Jun 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
14946
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
6
2184
by: Mike Guerrieri | last post by:
I have a few objects that I've created, Contact, Address, AddressCollection (inherits from CollectionBase), dtaContact, and dtaAddress. One of the properties of the Contact object (Contact.Addresses) is a Type of AddressCollection. When I want to add a new contact to my database I create a new Address object for each address and a new AddressCollection object. I then populate the Address objects and add them to the AddressCollection...
12
2807
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of function descriptors for the overloaded functions of that name. A function descriptor would contain the address of the function to be called, and a description of the parameters that it must take. b. A list of parameters. This would be compared to the...
39
7663
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down indicate: a) That I don't know enough b) Passing arguments by ref is bad
3
3793
by: Mark | last post by:
Hi From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes a variant containing an array, and interop expects a parameter of type object if you are passing a variant (you are expected to cast it to the correct type in your code). I'd like to find a way of passing arrays so that you don't need to change...
1
2951
by: PJS | last post by:
I am trying to use a COM object which has a parameter of type Collection in VB6. .Net recognizes this collection as a VBA.Collection object. When I try creating a VBA.Collection in .Net using: Dim objColl As New VBA.CollectionClass() I get the following error: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in WindowsApplication4.exe
11
8128
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line number) which is the last line of the following sub routine: ' procedure modifies elements of array and assigns ' new reference (note ByVal) Sub FirstDouble(ByVal array As Integer()) Dim i As Integer
13
2519
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On Error GoTo err_zoom strFormName = formName
3
2105
by: Ross McLean | last post by:
Hi all, I've been teaching myself C# for a new project at work. I have a bit of a background in c++ and java but never been what you could call a guru. I'm having some strange things happening when I pass a class as a parameter to a Windows Form. Basically, I have a class that has several fields, two of these fields are an instance of an inner class, the rest are basic value types (bool's in this case). I have a windows form, the...
0
9001
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9584
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9398
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6081
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4716
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2227
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.