Re: Creating A Custom Collection
From: Matt Berther (mberther_at_hotmail.com)
Date: 09/17/04
- Next message: Mark L: "Re: How to retrieve serial number of OS or CPU for copy protection"
- Previous message: Drebin: "Re: test for existence of file"
- In reply to: Kapil: "Creating A Custom Collection"
- Next in thread: Kapil Pershad: "Re: Creating A Custom Collection"
- Reply: Kapil Pershad: "Re: Creating A Custom Collection"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 12:16:49 -0700
Hello Kapil,
I have an introduction to implementing CollectionBase to create a strongly typed collection available on my website:
http://www.mattberther.com/2004/09/000540.html
You'll have to get away from using multidimensional arrays. I see an object in what you describe.
public class Parameter
{
public string Name;
public SqlDbType DataType;
public object Value;
}
I'm using fields as an example, you would probably go through and implement these as properties. From here, you'd create your CollectionBase derived implementation to work with this Parameter class.
You're resulting code would look something like this:
ParameterCollection coll = new ParameterCollection();
coll.Add(new Parameter("name", SqlDbType.Int, "value"));
Hope this helps...
-- Matt Berther http://www.mattberther.com > Hi, > > I have an idea but I need some help. Basically I want to create an > object that is used to communicate between the front end of my > application and the database. This object will be used by my data > layer to execute stored procedures on the database. It will receve > such parameters such as: > > string StoredProcedureName, string UserName, string TransactionType > and one more which would be a collection of some sort. I would send > this object to send it an object that holds the parameters for the > stored procedure so it can walk this object to create a SqlCommand > object and execute the stored procedure. > > The problem is that how do I create a multi demencial array where the > first column has a type of string and is called ParameterName, the > 2nd column has a type of System.Data.SqlClient.SqlDbType and be > called ParameterDataType, and the 3rd should be of type varient or > object since and be called ParameterValue. > > The point of all this is to allow the business layer of the app to > send the name of the proc and the parameters object to the data layer > and the data layer can walk the parameter object and convert it to an > SqlCommnad and execute a stored procedure. > > I think creating a custom collection may help but I have never used a > collection and it seems that I can only have one dimension in a > collection or a name value pair. > > Any ideas? > > Thanks > KP
- Next message: Mark L: "Re: How to retrieve serial number of OS or CPU for copy protection"
- Previous message: Drebin: "Re: test for existence of file"
- In reply to: Kapil: "Creating A Custom Collection"
- Next in thread: Kapil Pershad: "Re: Creating A Custom Collection"
- Reply: Kapil Pershad: "Re: Creating A Custom Collection"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|