I am new to c#.net.i have a method where i pass parameters in a loop and for each parameter there are different rows returned .rows (which have data of different data types) from database.I want to store that data rows somewhere like arraylist. and use for furthue peocessing.Plz tell me how to do this. enter code here
/*ideally Get_ChildAndParentInfo(int pointid) function returns array list but how to deal with array list containing datarows with different data types */
public static ArrayList Get_ChildAndParentInfo(int PointID)
{
i have a list for my shopping cart which i currently store in my datatable and then store it in a session. to avoid using sessions is it best to create a class where the datatable is stored and can be accessed from anywhere?
I am having a page where I need to maintain around 70 to 80 hidden fields to store some values. These are required because I need these values for executing some code at the client side (validations, calculations, etc,.) in java script.
Wanted to know if there is a better way of storing these values in my page instead of using hidden controls because I guess using so many hidden controls is making my page very heavy.
Something like a hash table or list dictionay that I can access from both the server side code and clint side java script?
I've created a website that allows users to register, log in, create tasks, be added to tasks. I want to the user to be able to add hours to these tasks, for a summary page that will contain a chart. I want to store all previous hours worked on the task so that the user will be able to view a chart on progress of the tasks? What would be the best way to go about implementing this? I'm using VB.
I have 2 ListBoxes..ie ListBox1 and ListBox2.When Move items from ListBox1 to ListBox2,I want to save listBox2 values in Xml Files.When i open the page it will load lListBox2 values.
I'm trying to store multiple selected checkboxes from a single checkboxlist, but i don't know where to start. Imagine i have three tables: tbl_events, tbl_organisors and tbl_settings and i want to store the organisors of an event. Each event can have multiple organisors, so each organisor should be added as a single row into tbl_settings. I know how to bind tbl_organisors to a checkboxlist, but how do i store the results (meaning: add the rows to tbl_settings) ?
tbl_events: Event_ID (PK) and Event_Name tbl_organisors: User_ID and user_name. tbl_settings: Settings_ID (PK), Event_ID and User_ID
Checkboxlist:
[Code]....
SQLDatasource:
[Code]....
Initially all checkboxes will be unchecked, but users must be able to select multiple organisors from the checkboxlist and then store them into the DB by submitting a form. So the query will look something like: INSERT INTO tbl_settings (user_id, event_id) VALUES (@user_id, @event_id). And this is where my head cracks
1) How do i loop through all selected checkboxes and store each value (user_id) in a new row in tbl_settings? 2) After saving, the users reloads the page and the organisors he just selected must be selected by default in the checkboxlist. How?
The value placed in my table ends up being either "True" or "False".
So when I try to query the table based on that value with a stored procedure it doesn't work since its looking for a 1 or a 0.
I think the .ToString() is part of the problem but i don't know the syntax to have the value from the CheckBox.Checked to be written as 1s or 0s instead of true or false.
I am having two aspx pages(Page1.aspx,Page2.aspx).I am stioring values in Session in Page1.aspx and retriving the same values from Page2.aspx.But if the session value is null I am getting an error as 'Object reference not set to an instance of an object.'Here is my code..
currently in our application we have an ApplicationConfiguration class. It is basically just a static class with const values specifying certain application-global configuration options. Some of these values will rarely if ever change and are only put into the configuration for elegance/cleanness.
Some of these values though do need to be different between production and development. So I'm considering making this class just a wrapper over Web.config. These values are checked many times throughout our codebase. If I change these from a const to a read-only getter that reads from Web.config will this affect compiler optimizations or make our application in any way slower?
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.
SCANNER RESULT: Stock B, StockC (ideally this result would be displayed in a GridView)
Now this seems like an easy task for a simple SQL JOIN statement, but the problem is that the SQL statements I've written for some criteria are already so complex that it's unthinkable to combine them further by using a SQL JOIN statement.......(yes I've tried and failed).
I think the only way to accomplish this is to put each criteria-filtered result into an array or datatable, and then try to query to see which stocks exist in all the arrays/datatable (in other words satisfy all criteria), and to display these stocks in a gridview. After doing some research online, it is possible to do query from multiple datatables by either using:
JOINVIEW(DataRelation) or LINQ
But which one is the best method (if it works)? I didn't consider using a loop for this since it would be too inefficient, especially if a user select many criteria.
On one of my web pages, I want to have two tables. One is going to be a summary table and the other a more detailed breakdown of the summary. When the user clicks on one of the rows of the summary table, I want the corresponding breakdown rows to appear in the breakdown table.
These tables can have anything between 60 and about 500 rows.
I have thought of two possible ways of doing this and I'm not sure which is best, or if there is another, better way of implementing this:
1) When a user clicks on one of the rows in the first table, a postback event happens, and the data for the second table is loaded from the code behind.
2) When the webpage is loaded for the first time, both tables are filled with all of the possible data, but all of the rows in the second table have the "display: none;" CSS attribute. When a user clicks on a summary row, the CSS of the corresponding breakdown rows is changed using JavaScript.
but back in the days of Webforms you would return a Dataset which you would then bind to a grid. But now in MVC you're not supposed to pass a datatable because you cannot serialize it and it's technically passing objects into the View where it doesn't belong? But how on earth am I meant to display data on a view?! I can't use LINQ to SQL classes here since this is a pure in memory data structure.
Ideally I'd just like to able to have an object which I can iterate within the view.
I'm really at a bit of a loss I have read the article from the "Gu" and I can only surmise that I have to pass back a ViewData Object instead?? Am I going nuts here?
I am trying to combine two datatables into single datatable... First table contains 3 columns[e.g: 'col1','col2','col3'] Second table contains 2 columns[e.g: 'col4','col5'] Both tables have the same no.of records[rows], but different columns. How to combine them into single table? I need DataTable with columns ['col1','col2','col3','col4','col5']. I am inserting through looping the both the tables and adding values into third table. I tried the Merge (DataTable.Merge()), but it is adding the records to bottom of first one, but i need it should be added to the side[as columns] to first table'
I need to compare 2 DataTables that do not necessarily have the same structure. One dataTable is the master (dtDB), the second dataTable (dtFORM) is what will have the changes, if any, but not necessarily all of the columns of dtDB. In both tables the first column will be the primary key and all columns that dtFORM has, dtDB will have.
There is another DataTable (dtResults) that will flag the differences
Also tried the logic as follows that removes rows with same IDs in both tables and updates datatable2's rows and only the ones that don't have duplicated IDs will remain...This didn't work either.
if (datatable2.Rows.Count != datatable1.Rows.Count) { if (datatable2.Rows.Count != 0) { for (int k = 0; k < datatable2.Rows.Count; k++)........
How do I fetch those "CAPTIONS" whose corresponding "NAMES" do not exist?
Note:- Rows in both datatables will vary based on some logic. What I want is to fetch that CAPTION from datatable1 who's KCID doesn't exist in datatable2.
edit:- How else do I loop through datatable1's rows and check which ID(from datatable1) doesn't exist in datatable2 and then print those captions on my page?
@CodeInChaos:: I have not worked with Linq-To-Objects at all so not able to understand your code :/
Is there any other way to loop through that datatable and fetch "caption " who's correcponding "Name" doesn't exist in the datatable2?
I have inherited an ASP.NET 3.5 application that relies heavily on sessions and storing DataTables within them (I know - bad, bad, bad). The application pool on the remote shared hosting service indicated that memory is at full capacity and as a result customers are losing their shopping carts because of dropped sessions.
Ultimately the goal is to rewrite this code, but for the time being I would like to stabilize the site the best I can. The host has recommended I use SQL Server Session State instead of in-proc. I have no experience with this, so I'm hoping it's as simple as running the .sql against the database to configure SQL Server and updating the web.config.
I have two datatables with same columns. I want to compare those two tables and I want to know whether data in those tables is same or different. If both Prod and Qty are same then I have to get true or else false.
That is
TblOne Prod Qty A 2 B 2 C 3
TblTwo Prod Qty A 1 B 2 C 2
As of now I am looping thoruh all the rows. Is that the only solution or is there any best way to do this ?
I have 2 views in sql server and I create a dataset with those 2 views as datatables. Now I need to create a datatable and programmatically fill it with the other 2 datatables. Take the 2 datatable and create a third one in the dataset not create a third view in sql server.
The case is: I use a webservice that gives me information about companys. For example: I entered a companyname and the webservice give me a list of al company's in the country. The webservices return a one dimensional array. The problem is that I must search in two register so the webservices returns 2 array's. I put the data from both arrays into 2 datatables. The data in the 2 datatables can be different or the same.
The question is: How could I matching the data on ID and combine the data into 1 datatable.
The code:
//Create result SearchResult Result1; SearchResult resultZoekmogelijkheid2; //send van Soap Request