VB.NET - Ordering Help

Asked By thushara nireesh
02-Sep-10 07:15 AM

 DA = New SqlDataAdapter("select * from tb_product WHERE SYSTEM='" & cmbSystem.Text & "' and Supplier='" & cmbSupplier.Text & "' and subsystem='" & cmbSubSystem.Text & "' order by SUBSYSTEM asc", con)

The result is as follows
A
B
C
But if it contains numeric also

The result is as follows

32 Ch.
16 Ch.
8 Ch.
A
B
C.

I want the result to be lik this

 8 Ch.
16 Ch.
32 Ch.
A
B
C

 

What can i do for this

  Reena Jain replied to thushara nireesh
02-Sep-10 08:26 AM
hi,

its not possible if datatype is nvarchar, you can use one more field as id and delcare it as int then you can use order by with query

select * from table1 order by id desc

hope this will help
  Sagar P replied to thushara nireesh
02-Sep-10 10:41 AM
Assuming that there will be space between number and character this query will work fine;

select * from tb_product
order by cast(left(SUBSYSTEM, charindex(' ',SUBSYSTEM) -1) as int) ASC

Create New Account
help
Difference between vb and vb.net Hai, I want to know about the main difference between vb and vb.net. • The greatest change in VB6 and VB.NET is of runtime environment. VB6 used the VB-Runtime while VB.NET uses the .Net Common Language Runtime (.Net CLR). The CLR is much better designed and
Differences for vb.net and c# with Example Dear all Differences for vb.net and c# with Example., plz give the solutions Thanks to all Hi See the bellow comparission :: This comparission is with syntax and example. . . Comments VB.NET 'Single line only Rem Single line only C# / / Single line / * Multiple line * / / / / XML comments on single line / * * XML comments on multiple lines * / Program Structure VB.NET Imports System Namespace MyNameSpace Class HelloWorld 'Entry point which delegates to C-style main Private
types? (B) What is concept of Boxing and Unboxing ? (B) What is the difference between VB.NET and C#? (I) what is the difference between System exceptions and Application exceptions? (I)What are different properties provided by Object-oriented systems? (B) How can we achieve inheritance in VB.NET? (I) what are abstract classes? (B) What is a Interface? (A) What is difference between prevent a class from overriding? (I) what is the use of “Must inherit” keyword in VB.NET? (I) Do interface have accessibility modifier. (A) What are similarities between Class and structure? (A between Class and structure’s? (B) What does virtual keyword mean? (B) What are shared (VB.NET) / Static(C#) variables? (B) What is Dispose method in .NET? (B) What is the use
diffrence what 's diif b / w vb.net & c#.net refer the link, it explan u Syntax Differences and Managed and Unmanaged code in earlier versions. You have lot of articles to find out the differences b / w VB.NET & C#.NET depending on various aspects. Iam providing a few, which were discussed in different aspects. Go through them. http: / / support.microsoft.com / kb / 308470 some key syntactical differences between VB.NET (version 2) and C#. http: / / www.harding.edu / fmccown / vbnet_csharp_comparison.html Choosing between C# and VB.NET: http: / / www.dnjonline.com / article.aspx?ID = mar05_vbvscsharp Complete Comparison for VB.NET and C
Diff between C# and VB.Net I know 60 to 70 percentage of C#. In Some Interviews asked me. Do you know vb.net like that. First of all what is the difference between C# and VB.Net There is very little difference. The are both languages that target the Common Language Runtime The only real difference is the syntax that you use. VB.NET tends to be more verbose. This is the most debatable issue in .NET community and