Storing ArrayList Of Different Objects?

Feb 26, 2010

Is there an easy way of storing an ArrayList containing different custom objects? I guess the easiest way for me would be to use a foreach to store each object into our database, but how would I read them out of the db and assigning them to the correct class?

View 8 Replies


Similar Messages:

.net - Storing 3 Arraylist Into One List In C#?

Mar 17, 2011

I have three ArrayLists with string elements and I want to store them into one List/ArrayList/String Array/Dictionary.

I mean I want to add them. I don't know which one How can I do it? What should I use?

It is in asp.net/c#.

View 3 Replies

Counting Number Of Objects In Arraylist?

Jan 2, 2011

I have a gridview where there is a column of checkboxes for the user to check on for the products he/she wants. After checking, they will have to click on a button. for every checkbox that is checked, the result will be stored in an arraylist. after the button is clicked, the label will show the count of the number of objects in the arraylist, which is the number of items that were checked. However, it appears that objects are not being added to the arraylist. What's the problem? Below is some portion of the code for more understanding.

[Code]....

View 4 Replies

Storing PDF Files As Binary Objects In SQL Server?

Feb 27, 2010

I have to find a design decision for the following task: I have a SQL Server database and it contains a table of orders. PDF documents will be uploaded by users through a simple file upload from a web page and assigned to an order. There is not more than one document per order (perhaps no document, never more than one). For this purpose a user opens a web page, enters an order number, gets the order displayed and clicks on an upload button. So I know to which order the uploaded document belongs to.

Now I am considering two options to store the documents on the web server:

1) Extend my table of orders by a varbinary(MAX) column and store the PDF document directly into that binary field.

2) Save the PDF file in a specific folder on disk and give it a unique name related to the order (for instance my order number which is a primary key in the database, or a GUID which I could store in an additional column of the order table). Perhaps I have to store the files in subfolders, one per month, and store the subfolder name into the order row in the database, to avoid getting too many thousand files in one folder.

After the PDF files are stored they can be downloaded and viewed via browser after entering the related order number.

I'm tending towards option (1) because the data management seems easier to me having all relevant data in one database. But I am a bit afraid that I could encounter performance issues over time since my database size will grow much faster than with solution (2). Around 90% or even 95% of the total database size would be made up only by those stored PDF files.

Here is some additional information:

The PDF files will have a size of around 100 Kilobyte each
Around 1500 orders/PDF files per month
Windows Server 2008 R2 / IIS 7.5
SQL Server 2008 SP1 Express
Not quite sure about the hardware, I believe one QuadCore Proc. and 4 GB RAM
Application is written in ASP.NET Webforms 3.5 SP1

(I am aware that I will reach the 4GB-limit of the SQL Server Express edition after around 2 years with the numbers above. But we can disregard this here, either removing old data from the database or upgrading to a full license will be a possible option.)

My question is: What are the Pro and Contras of the options and what would you recommend? Perhaps someone had a similar task and can report about his experience.

View 5 Replies

How To Avoid Storing Different Type Of Objects In The Same Place When Represent The Same But With A Different Data Structure

Jan 14, 2010

This is in my opinion an abstract problem and I hope I can explain it well. I happened to find the same kind of problem in a completely different project and now I have it again and I would like to avoid it if possible.

I'm creating some classes to simplify some tasks for some specific requirements we have in some projects at work.

I have a class that creates objects which maps the values from webcontrols to an object properties similar to this

[URL]

The problem I have it's sometimes I have to store a non container object in a place (in an object's attribute) and sometimes I have to a store a container object in the same place for storing the values of a webcontrol (a webcontrol can sometimes hold several values like a checkboxlist). I dont like this at all, because some time ago when working in a non commercial compiler, when parsing and generating the intermediate code I had sometimes to store a container in a place, and sometimes I had to store a non container in the same place, and having to ask in other parts of the code if what you are reading is this type of object, or this another type of object, it is something really annoying and it mess up the code. Is there any tips about what it would be better to do to avoid this kind of situations or nothing can be done to avoid it sometimes?

View 3 Replies

State Management :: Multidimentional Arraylist / Create A Arraylist Which Will Able To Store User Info?

Jul 16, 2010

i want to create a arraylist which will able to store user info like (username,machineIP,port ) for each user in the list & retrive this data when needed . any one tell me how i can do it or any alternative way without database or xml file.

View 6 Replies

Storing A Uploaded File In DB Or Storing It In Filesystem?

May 11, 2010

I have a File Uploader in my ASP.NET application Using C#, we can upload any type like images, documents, pdf etc.

I m storing it in the Filesystem and having only the Name of the File in DB.My doubt is can we store the entire file, images in DB. State me Which is good practice and why we need to use it.

Either file System Storage or SQL DB Storage.

View 4 Replies

Forms Data Controls :: Binding A Repeater To A List Of Objects That Have Child Objects?

Nov 17, 2010

have some Objects, lets say Employee and Role defined as below and I have defined relationships in my database that gives me a list of objects say employees and thanks to my framework each employee object also has a Role object linked via the RoleIDID, UserName, Password, Email, RoleIDRoleID, RoleNameSo in code I can do something like this

Employee emp = dataService_GetEmployeeByID(1);
string RoleName = emp.Role.RoleName;

Now here is my problemI can bind any object in a repeater and it works fine for the first level in my relationship

For instance <%# Eval("UserName") %>

But I need to be able to show the details for my child objects as well (Role) so something like this (which does not work)

<%# Eval("Role.RoleName") %>

View 2 Replies

Forms Data Controls :: Binding An Objects(containing Sub Objects) To A Dropdown List?

Apr 6, 2010

I know how to bind a simple objects to a dropdown list. However I am having problems binding my objects which contains sub objects to the control.i.e. with simple object i just do ddl.DataValueField = "myproperty"
with my objects they contains sub objects which i want to bind. I have tried ddl.DataValueField = "sub-object.myproperty" which doesnt work.

View 2 Replies

Architecture :: Using Static Methods To Build User Objects And Various Other Objects?

Jun 21, 2010

firstly a static class only ever exists once and is not an instance. Any static members (ie static int NoOfPeople;) is stored in one place and is shared between all sessions (like the old global variables).
Now static methods is where i'm not 100% sure. If I have a static method that doesn't use any other static members could this cause inconstant results, example (this is a fairly pointless method but just a quick example of the top of my head)

[Code]....

So in this example if two sessions (or threads) were to call this at the same time - would they both get back the expected results, because the method only uses private data (a, b and totalToReturn).Im sure this sounds a little simple but I will be using static methods to build user objects and various other objects that there will have to be a 100% garentee that the objects will not get mixed up between sessions and the wrong things return to the user.

View 5 Replies

Dynamic Data Be Made To Work With Custom Business Objects Rather Than Data Objects?

Feb 24, 2010

I'm working on a project in which we have a database, data layer (entity framework), business layer and web/UI layer.I want to use ASP.NET Dynamic Data for the web layer, but don't want it to access the data layer or database, as I want it to be purely running off business logic, and not directly accessing the data.However, it appears that Dynamic Data only allows Linq-to-SQL or entity framework data sources to be used.Has anyone used it with business-layer objects instead?

View 1 Replies

State Management :: How To Link The Objects Between Browser Session And Session Objects

May 10, 2010

Lets say I am doing a shoping cart. I authenticate the user with a session variable.For example:

If(Request.IsAuthenticated)
// Here I want to add to the shoping cart.
// Can I do the following
Session["Cart"] = "Washing Machine";
Now will this Session["Cart"] value which is washing machine here be unique to diff customers?

View 1 Replies

What Application Objects Or System Objects Are Stored In The Application Pool

Feb 1, 2010

I hosted my application in production. Within 5 to 6 hours the application pool spikes and uses more memory?

What application objects or system objects are stored in the application pool?

View 3 Replies

2 Dimensional ArrayList In VB.NET?

Jun 16, 2010

I am looping through a dataset and I would like to have the following in this array list

name, from, to, price
john, 40, 50, 39.99
mike, 20, 50, 49.99
etc.

Once I do that, or if it is possible to do it using the dataset that will work with me. But I want to do...

If john's price between from and to...

So in my code I wanted to make it easy for me and instead of memorizing the row #, I would just do.. arraylist.row("john").item("from")

View 6 Replies

C# - How To Convert A Arraylist To String

Dec 6, 2010

How can I convert a arraylist to a string?

View 4 Replies

ADO.NET :: How To Order An Arraylist With Linq

Sep 9, 2010

Is there a way I can sort this query result in Linq? I'd like to sort in descending order by the .Count parameter:

[Code]....

View 2 Replies

ArrayList Binding To Gridview?

Jan 26, 2011

I have an arraylist of string items that I want to bind to a gridview.I want to bind the value from each item to a asp:HyperLinkField but I dont know what the DataTextField should be? The arraylist obviously doesn't have a column heading as it's just 1 dimensional.What value do I need to use in the DataTextField?

View 3 Replies

Web Forms :: Distinct Arraylist Value Using C#?

Feb 22, 2010

how to distinct arraylist value using c#?

View 10 Replies

Accessing ArrayList In Javascript

May 10, 2010

I have ArrayList in my Model and want to iterate through it in my javascript. I am using following code but its giving me error : CS0103: The name 'i' does not exist in the current context

for(var i=0; i <= <%=Model.KeyList.Count%>; i++)
{
alert('<%=Model.KeyList[i]%>');
}

How to get rid of this?

View 3 Replies

How To Do Empty Arraylist In Immediate Window

Jun 8, 2010

how can i do empty Arraylist in immediate window in asp.net

View 1 Replies

IComparer For ArrayList.sort?

Feb 28, 2010

How to compare array in arraylist by name.I try many thing but no one works.public class myReverserClass : IComparer { int IComparer.Compare( Object x, Object y ) { ... }

View 1 Replies

Delete All Arraylist Item?

Jan 11, 2010

how can i delete all arraylist item?

View 6 Replies

C# - Filling An Arraylist From A Datareader?

Mar 15, 2011

I have a problem with how to fill an array list from a data reader

string queryDTL = " SELECT * FROM tbl1 ";
connection.Connect();
cmd = new OracleCommand(queryDTL, connection.getConnection());
dr_DTL = qcmd2.ExecuteReader();
ArrayList RecordsInfo = new ArrayList();
while (dr_DTL.Read())
{
RecordsInfo = dr_DTL["number"].ToString();
}

The problem is the datareader contain alot of info other than the number but I don't know how to put them in their correct position.

View 3 Replies

Deleting Files From ArrayList In C#?

Dec 3, 2010

I have an Array List to save selected files and a ListBox to display only the name of the files..my requirement is to delete corresponding files from arraylist when its deleted from listbox...here is my code:

public ArrayList to_compress = new ArrayList();
ListBox pack_lbx=new ListBox();
private void add_btn_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();

[Code]....

View 5 Replies

Passing ArrayList To Another Page?

Jan 2, 2011

I have a gridview with a column of checkboxes. On checking the checkboxes, they have to click on a drop down list that will redirect them to another page. The value of the checkboxes are stored in an arraylist. However, the problem is how can i pass the arraylist to the redirected page?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved