.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

DataTable - How to get max and min values

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
 
Hi all, I have constructed a DataTable in the following way ---  DataTable projectedCPMdt = new DataTable();         projectedCPMdt.Columns.Add("ProjectedCPM", typeof(string));         projectedCPMdt.Columns.Add("0%", typeof(int));         projectedCPMdt.Columns.Add("1%", typeof(int));         projectedCPMdt.Columns.Add("2%", typeof(int));              projectedCPMdt.Rows.Add("70%", 1, 2, 3);         projectedCPMdt.Rows.Add("80%", 4, 5, 6);  DataTable projectedCPMdt = new DataTable();        projectedCPMdt.Columns.Add("ProjectedCPM", typeof(string));        projectedCPMdt.Columns.Add("0%", typeof(int));        projectedCPMdt.Columns.Add("1%", typeof(int));        projectedCPMdt.Columns.Add("2%", typeof(int));        projectedCPMdt.Rows.Add("70%", 1, 2, 3);        projectedCPMdt.Rows.Add("80%", 4, 5, 6);Its like a grid of values. And I need to select the max and min. In this case max = 6 and min =1.Can someone tlel me how to e


View Complete Post


More Related Resource Links

Insert values into a datatable.

  

Hi,

I have a datatable with 5 columns. Then i added another column "date" to this datatable.

I want to insert value  in every row for this column in this datatable.

When i use the following i am getting  Error-- ---- Conversion from type 'DataRow' to type 'Integer' is not valid.

How can i insert values into a datatable?

Thanks

 

 Public Sub insertBrktoDB()

    Dim mydt As New DataTable
    mydt = BreaksCSV()
    Dim dt As DataColumn = New DataColumn("Date")
    dt.DataType = System.Type.GetType("System.DateTime")
    mydt.Columns.Add(dt) '--------------p_date is a property which has the value to be inserted
    p_date = ds_rte.Tables("sched").Rows(1).Item("mdate").ToString
    For 

how to store the datatable values into the 1-D array

  

hi all ,

how to store the datatable values into the 1-D array , i know in for loop ... other than that is there means let me know please


wroking on datatable to fetch only distinct values of particular column to assign to dropdown list.

  

As I kept my fetched datatables into session and accessing it on another page there I am

wroking on datatable to fetch only distinct values of particular column to assign to dropdown list.


How to get count of repeated values in datatable in asp.net.

  

Hi,

I want total count of repeated values in a datable.

 

as shown in image total count should be : 2 because repeated values are only 1 and 2.

I tried as given below:

DataView dv = new DataView(dtTemp);
int iRowCount = dv.ToTable(true, "Column1").Rows.Count;

but it returns 3 which is incorrect.

Does anyone knows how to do it.

I don't want to use loop becoz sometimes data table contains 4000-5000 rows so if we use loop it will take much more time to get the total count.

Thanks.


How to Pass Values Between Web Pages ASP.NET

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

How to Pass Values Between ASP.NET Web Pages

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

How to bind GridView and DropDownList controls using DataTable object

  
In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.

DataTable - Load from IDataReader - CreateDataReader - ReadXml WriteXml - Free ADO.NET Tutorials

  
The DataTable in ADO.NET 2.0 has been seriously beefed up and I absolutely love it. Not everything we consume deals with multiple resultsets and requires the ever popular DataSet. With the cool new features in the ADO.NET 2.0 DataTable, we can get many of the cool features in the DataSet without all the extra baggage and memory footprint particular to multiple resultsets.

Load DataTable from IDataReader

jquery autocomplete multiple values

  

i got some samples and i did autocomplete using jquery , its working well for single input values

but i need to pass multiples values after one by one in the textbox. Is it possible to pass multiple

values in the textbox for autocomplete in jquery in asp.net?

 


JQGrid Loading deleted values

  

Hi,

This is quite strange. here is the issue:

Some Info:

1. I'm using a multi-select jqgrid.

2. I have my own delete button to delete multiple orders

The problem:

When i press the delete button on the pager of my jqgrid, the records are deleted from the database but JqGrid shows some records (4-5). On refreshing the grid, correct numbers of records are shown.


Here is the code:


function delorder() {
        var amg = $("#horder").getGridParam('selarrrow');
        var cont = amg.length;
        if (amg.length > 0) {

How to cast integer values as an array of enum values?

  

Hello all!

I'm working with VS2010 Beta2, ASP.NET and Dynamic Data. I'm using VB but will certainly be happy to receive a C# example if necessary. Laughing

I used a few of Steve's examples (Writing Attributes and Extension Methods for Dynamic Data and Dynamic Data - Hiding Columns in selected PageTemplates) to create a custom property attribute to be applied to a dynamic data column and want it to accept an array of enum values (each value will represent a dynamic data page template where this column should not be displayed).  My new attribute works fine when I hardcode it like this, meaning the HideColumnIn attribute is properly populated with the array of enum values:

<HideColumnIn(PageTemplate.List, PageTemplate.Edit)> _
Public Property My_DD_Column As Object

 

However, I want to store the values to be used for the HideColumnIn in the DB as integer values that correspond to the

Passing values in pages

  

Hi! Friends..

how to pass the value from one page to another page in asp.net  with out Using State Management Concepts?

Like 1. cookies

        2.Session

        3. QueryStrings

     With out using the above should pass the values...


Datatable in session

  

I am creating a simple shopping cart using a datatable that is passed into a session object.  I have a small mini cart that displays the total number of items in the cart as well as the running total - this is displayed in a web control.  When the web control starts up I run a try/catch to see if the session object exists, if it doesn't I create the datatable for the cart and store it in the session.  I then have a datalist control that contains all the information for my products including an "add to cart" button.  When the page loads everything looks fine.  If I click on an "add to cart" button nothing happens to the session information.  If I click on it again, the session information updates - displaying only one item is in the cart and then counts up correctly there after.  Additionally, after adding an item, if I select a different item in the list, the same issue occurs.  I am not sure why this is happeing, if anyone can give me an idea I would appreciate it. 


holding datatable value using session

  

Hi,

iam insert record using datable in gridivew,iam using  session to hold the record,

there is any other way to hold the record in datable.

dtempty.Columns.Add("storeid");   
        dtempty.Columns.Add("ratetypeid");
        dtempty.Columns.Add("ratedesc");
        dtempty.Columns.Add("slabs");   
        dtempty.Columns.Add("days");
        dtempty.Columns.Add("rate");
        dtempty.Columns.Add("contid");
        dtempty.Columns.Add("continertype");

        DataRow row;
        row = dtempty.NewRow();
         
        row["ratetypeid"] = ddlratetype.SelectedValue;
        row["ratedesc"] = ddlratetype.SelectedItem.Text;
        row["slabs"] = ddlslabs.SelectedValue;   
 &n

removing item from datatable

  

hi to all ..thanks in advance

 

I have Two datatables dtA,dtB ,both contains column name is "FiledName" I need to remove item

from dtA when same row data exists in dtB.  please tell me how to do it

dtA    dtB   

 A        A

 B        F

 C        C

 D        Z

I want o/p like this

0/p

dtA

   B

   D

 

 


how to bind Dropdownlist based on textbox values

  

hi

I have one drodownlist which show data based om textbox values...

Let us consider i have 

Select Name from table1 where Type IN(@typ)

here @typ is textbox values

here for example textbox will have some thing like this L1,L2,L3..

How to filter Name based and shown in drodownlist based on this L1,L2,L3(on textbox)..

Help me in this


Bulk Copy From Datatable To SQL Server Table

  

 I have read the data of a excle file and captured the data into the dataset to a datatable, now that data is to be inserted into a SQL Server table using bulk copy option. I am using -

 public bool BulkEnterData(DataTable dt, string tblName)
    {
        SqlBulkCopy bulk = new SqlBulkCopy(con);
        bulk.DestinationTableName = tblName;
        
        con.Open();
        bulk.WriteToServer(dt);
        con.Close();

        return true;
    }

ERROR Getting-
A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.) 

How to resolve the above problem or any other solution is available.

 


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend