Sort DataAdapter Alphabetically - VB.Net

Nov 30, 2010

This should be a fairly simple one. I am creating a dataset which will contain a description field which I would like to sort by. The reason I want to sort the dataadapter and not in my SQL is that I am already ordering by the results that have a particular value. My SQL looks like this:

SELECT pif_desc, pif_fund, psf_end, (CASE WHEN SUM(pmi_units) IS Null THEN 0 ELSE SUM(pmi_units) END) As fundunits FROM tbl_mem INNER JOIN tbl_sfunds ON pm_scheme = psf_scheme INNER JOIN tbl_invfun ON tbl_fund = tbl_fund LEFT JOIN pe_minv ON pmi_fund = pif_fund AND pm_member = pmi_member WHERE pm_member = @pm_member GROUP BY pif_desc, pif_fund, psf_end ORDER BY fundunits DESC

My VB looks like this:

Dim cmd As New SqlCommand("getMembersFundsDCGENST", conn)
cmd.CommandType = CommandType.StoredProcedure
Dim p_pm_member As New SqlParameter("@pm_member", SqlDbType.Int)
p_pm_member.Value = pm_member
cmd.Parameters.Add(p_pm_member)
Dim p_period_closing_date As New SqlParameter("@closingdate", SqlDbType.DateTime)
p_period_closing_date.Value = period_closing_date
cmd.Parameters.Add(p_closing_date)
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds)

I want to sort the datarows is ds.tables(0) by pif_desc but still have the rows with fundunits > 0 listed first.

View 2 Replies


Similar Messages:

Web Forms :: How To Sort Treeview Alphabetically

May 7, 2010

I am dynamically binding the treeview using DOM.

I m populating the tree by sayin treeview1.nodes.add(Treenode)

After this, i need to sort them alphabetically. I have followed this ref:[URL] but I was not able to understand how to do it only for parent nodes, since I don't have child nodes.

Moreover I m not able to get property sort().

How do I achieve this?

View 1 Replies

Visual Studio :: How To Sort Templates Alphabetically

Feb 8, 2010

I'm wondering if Visual Studio is ever going to allow users to sort the available templates alphabetically.

When clicking on File | New File, I'm greeting with the New File dialog window, which has a seemingly arbitrarily ordered list of items to choose from. This isn't so bad, because there aren't that many, but it would still be nice to order them.

When right-clicking a project, and choosing Add | New Item, I get a Add New Item dialog box that has the same dementedly senseless order, and there are many more of them. Fifty-three on my system, in fact. Having no easy way to order these alphabetically is a serious pain, and I've seen complaints about it all over the Internet. Does anyone know of a way to get Visual Studio 2008 to order these templates alphabetically, and does anyone know if Visual Studio 2010 will finally include this feature?

I found a PowerShell script online that was supposed to accomplish this, but it appears to have been written for .NET 2.0, and I'm using .NET 3.5. I don't have the time to pick apart the PowerShell script and hope I get the modifications right.

View 2 Replies

Web Forms :: How To Sort The Names In Combobox Alphabetically

Feb 1, 2011

How to sort the names in combobox alphabetically?

View 3 Replies

Forms Data Controls :: How To Sort Dropdownlist Alphabetically

Jan 24, 2011

I need to sort dropdownlist alphabetically.

This is the code I am using ,its working but it brings numbers first and then alphabets like 1,2,abc,bcc..

[code]....

View 4 Replies

Forms Data Controls :: How To Change Sort Column Header Text And Retain The Sort Link

Jun 3, 2010

I have a simple dynamic gridview with following code -

GV = new GridView();

View 3 Replies

C# - Ordering A List Alphabetically?

Feb 4, 2011

my code will explain what the problem is in the WHAT DO I PUT HERE section how can get the list ordered by a-z?

View 3 Replies

C# - Order The Subcategories Alphabetically?

Mar 24, 2010

I have a table:Category with some sort of categorie

[code]...

Well, the strange question is: how can i order the subcategories alphabetically?
If i'd have binded the children repeater to a linq it would be easy.
But in this case?

View 1 Replies

Web Forms :: DataView.Sort Vs List.sort?

Mar 7, 2010

Actually i want to ask which is the best for sorting in Asp.Net is it DataView.Sort Method or List<Object>.Sort() method.

View 1 Replies

Web Forms :: Sort Datatable Without DefaultView.Sort?

Apr 20, 2010

I'm looking for a way to sort the rows of a datatable without setting the DefaultView.Sort to a specific column. I have a datatable in session that users can add records to. I want them to be able to sort the data by clicking on a button. But new records added after that need to show up at the bottom of the list until the sort button is clicked again.

View 2 Replies

C# - Sorting Digits In A String Alphabetically?

Feb 20, 2010

We have a list of titles, some of which start with numbers (e.g. 5 Ways to Make Widgets). We would like to sort this as if it were "Five Ways..." without changing the title. We know that some movie places do this, but I can't find info online on how to do it.

View 4 Replies

Sorting A Gridview Alphabetically When Columns Are Codes?

Jun 15, 2010

i have a gridview populated by a Web Service search function. some of the columns in the grid are templatefields, because the values coming back from the search (in a datatable) are ids - i then use these ids to lookup the values when the rowdatabound event is triggered and populate a label or some such.
this means that my sorting function for these id/lookup columns sorts by the ids rather than the textual value that i have looked up and actually populated the grid with (although i do put the ids in the grids datakeys).

what i want to do is top be able to sort by the looked up textual value rather than the codes for these particular columns.what i was going to do to get around this was to when the datatable comes back from the search, adding more columns the textual values and doing all the looking up then, thus being able to sort directly from the manually added columns.

is there another way to do this? as that approach seems like a bit of a bodge. although i guess it does remove having to do the looking up in the rowdatabound event....

my sorting function works by sticking the datatable in the session and on each bind grabbing the sort column and binding the gridview to a DataView with the sort attribute set to the column - and the direction.

View 1 Replies

Forms Data Controls :: Show The Category Name Alphabetically?

Jan 19, 2010

I am having a problem .I want to display the book category and subcategories which is fetched from database .

I want to show record like

Example
--------
A
Autobiographies
- Advertising
- Artists

[Code]....

How to show record like this and which control I have to use for this.

View 2 Replies

Data Controls :: Filter GridView Rows Alphabetically

Apr 28, 2014

LinkButton A
LinkButton B

A          B           C         D          E

-----------------------------------------

EmpID       EmpName   

1              Aakash
2              Ajit

View 1 Replies

Forms Data Controls :: Gridview Sort Expression - How To Reset A Gridview Or Prevent It From Doing A Sort

Sep 23, 2010

Just spent about 8 hours googling and looking through this forum for a solution on how to make sure that I can dynamically sort. Here is the situation.

I have 1 Gridview that displays 10 different scenarios based on what button is clicked.

I am also returning only top 10 records. I am doing all of the data binding pragmatically. So I have BoundFields, HyperLinkFields etc.

I also want to sort some records. When I change DataSource SQL statement the gridview somehow remembers what the last sort value was and it errors out saying that value "x" cannot be sorted because it does not exists.

I tried this:

Tried setting gridview1.sqldatasourceid = null; gridview1.allowsorting = false; gridview1.databind();

Here I get an error that says that the data source does not support sorting? Doesnt it say gridview1.allowsorting = false;

I also tried gridview1.sort("", SortDirection.Ascending); This does nothin... except query my database one more time because i have a onSorting event that looks like this:

[Code]....

Here is an example of just one of those SLQ statements inside GetSQLQuery:

[Code]....

View 1 Replies

Forms Data Controls :: Group Alphabetically And Give Page Break?

Feb 12, 2010

I want to do something like this.

[URL]

i have all the categories in my dataset. now i want my repeater to display it in alphabatically categories.

View 2 Replies

Forms Data Controls :: How To Sort Data In GirdView Via Sort Icons Clicks

Feb 28, 2010

i read Matt Berseth article also i downloaded this source. But i can not do sorting event. Everything is ok but sorting is not working.

[Code]....

View 3 Replies

What's The Difference Between A DataSource And DataAdapter

May 6, 2010

Title says it all. What is the difference between a DataSource and DataAdapter? I'm trying to decide if I should descend from IDataSource or IDataAdapter for code to be shared between Winforms and WebForms and I can't seem to figure out what the difference is other than slightly different ways to use them.

View 1 Replies

Web Forms :: DataAdapter - Get Rid DBConcurrencyException?

Aug 19, 2010

I have a DataSet containing a small two-by-two table. When I call the da.Update(DataTable) method, I get the infamous DBConcurrencyException. However, the change does get updated in the actual database. What's up with that? I checked the RowState for both rows and one is Modified while the other is Unchanged. I would very much like to get rid of that exception!

View 1 Replies

DataSource Controls :: Add Parameters On Dataadapter?

Jun 23, 2010

How could I add parameters on dataadapter? I tried

[Code]....

But parameters is unknown for dataadapter.

View 4 Replies

First Dataset - Dataadapter Namespace - How To Reference

Jun 25, 2010

How do I reference my data adapter? I've been running through some tutorials (worx Professional ASP.Net 4 in c#) but have become stuck after creating my data adapter and trying to reference it. Steps I have taken to get this far: Added an 'App_Code' folder to project and added a dataset in it. I dropped a data adapter onto the visual dataset designer screen and followed the prompts for select statement etc. I tested the query and it worked. So under the App_Code folder I have a 'Product.xsd' file, which has 3 files under it (Product cs,xsc and xss files.) Created a new object 'Web-> Webform'. I dropped a gridview onto the form and a couple of textboxes and a button for filtering (my select is narrowed down by a date range).Tried to put code into c# section to fill dataset on page load but ran into problems. Code attached below.

[Code]....

View 19 Replies

C# - System.outofmemoryexception When Filling DataAdapter?

Feb 23, 2011

I have to pull 150K records from DB. I am using da.Fill(ds,"Query") and its throwing system.outofmemoryexception.

Dim daGrid As New SqlDataAdapter(sqlcmd_q)
daGrid.Fill(dsGrid, "Query")
daGrid.Dispose()

I need this datatable only. I cannot use XML. because I need assign this to MSChartControl to display ScotterPlot.

View 2 Replies

SQL Server :: Writing The Whole Row In Database Using Dataadapter?

Jul 21, 2010

I have some problem in inserting the wholerow in mt database table at once.....I would like to explain it:i have a function as

public DataSet senddata()

{
........................... [code]...

Now I to insert this data into the database I have made in the same format(schema).I have a function like :

database name is ABC

tablename is XYZ

public void inserttodatabase()

{

DataSet ds= senddata();

View 5 Replies

DataSource Controls :: Getting Values To The Dataset From Dataadapter?

Dec 23, 2010

public static DataSet GetSubCategories(int category_id)

View 4 Replies

DataSource Controls :: Sql DataAdapter - Read Data From Sql DB

Feb 24, 2010

i'm tring to read data from a sql DB, where is email == mystring - then display its name here is the code:

string mystring;
mystring = "email@email.com";//"Welcome " + System.Convert.ToString(Session["user"]);
generalTableTableAdapters.kurtula_generalTableAdapter generals = new
generalTableTableAdapters.kurtula_generalTableAdapter();
generalTable.kurtula_generalDataTable genaraltab = generals.Getgeneral();
foreach (DataRow row in genaraltab.Rows)
{
if (Convert.ToString(row["email"])== user)
{
Label1.Text = System.Convert.ToString(row["name"]);
}
}

as you can see I'm a table adapter but is giving me the following error: i realy dont know what this error means - though i did a simular action using access DB (and it did work), where i had to user the following: using System.Data.OleDb; now because im using SQL DB im using: using System.Data.SqlClient; //sql server

View 3 Replies







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