|
i can use the union query to first select the numeric and then an another union query to sort alphanumeric.
Am i doing right?
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Sonia Gupta wrote: i can use the union query to first select the numeric and then an another union query to sort alphanumeric.
Am i doing right?
For the love of God Sonia, just try it. I'm not going to type your code out for you.
|
|
|
|
|
Convert the data type of the column on the fly using convert or cast then reorder the converted column using ORDER BY.
Make sure the converted type is integer!
|
|
|
|
|
Hi,
I don't think SQL offers the required ordering.
The "natural sort order" as used for file names by Windows Explorer is available through
P/Invoke, so you can implement an IComparer interface like this:
using System.Runtime.InteropServices;
public static int Compare(string s1, string s2) {
if (s1!=null && s2!=null) return StrCmpLogicalW(s1, s2);
else return string.Compare(s1, s2, true);
}
[DllImport("shlwapi.dll", CharSet=CharSet.Unicode, ExactSpelling=true)]
private static extern int StrCmpLogicalW(string s1, string s2);
I do not know how you could apply the above to database-based data; I would guess
you need to first fill a DataTable, then somehow get that sorted using the IComparer object.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Ordinarily I'd say left pad the numerics with SPACEs then sort, but SQL Server doesn't appear to have a PAD function? I thought Oracle did. What Database system are you using?
Some ideas for SQL Server:
select * from PadTest order by
REPLICATE(' ',8-LEN(X))+X
or
select * from PadTest order by
case ISNUMERIC(X)
when 1 then REPLICATE(' ',8-LEN(X))+X
else X end
modified on Friday, March 7, 2008 12:57 PM
|
|
|
|
|
Hi,
I have a windows form with Ten Textboxes and I want to set text with Zero "0" using foreach loop.
Kindly tell me the method.
Thank you in advance
(Riaz)
|
|
|
|
|
You can iterate through the controls on your form using Controls property and check whether the current control is textbox or not. If yes, set it's text to 0.
|
|
|
|
|
Hi,
I have to secure the HTTP communication between a client and a server which are placed on separate machines. Both client(C# appl.) and server(Java appl.) are desktop applications. I know that I have to create SSL on HTTP in order to obtain a communication over HTTPS. I don't know how to create the certificates and how to handle them. If you have any suggestions/links, write them here, please!
Thank you,
L.P.
|
|
|
|
|
The SSL certificate depends on what web server you are running. Try to Google "how to create https certificate" and you'll probably find an answer.
Hogan
|
|
|
|
|
Hi all,
The problem is I am unable to generate the an alert/popup from a windows service.
Can any body has got the solution for generating it.
Please help. Its urgent.
Thanks in Advance
Ankur
|
|
|
|
|
You can't!
Write to event log...
|
|
|
|
|
Thanks for the reply ..
but how does the general pop up ex: system connection, scan and etc pop up comes.
I think these are all services running in the system which on detecting the required thing generates an alert.
Isn't it???
Thanks
Ankur
|
|
|
|
|
It can be done in round round way..
1) Create another application ie form application and create a property that will be displayed as the message.
2) When you require to show the message create the object of this Form and set the property to the message you want and call the Show() Method.
3) Now go to your service right click > Properties > In the first tab you will find some check box called "Allow the service to interact with desktop") and restart the service.
Note : It is highly discouraged to set the option "Allow the service to interact with desktop".
Thanks
Laddie
Kindly rate if the answer was helpful
|
|
|
|
|
following is the code , i am using for the List class.
I am facing a problem regarding Find Function
Please help .
public person(string nam , int ag)<br />
{<br />
this.age = ag;<br />
this.name = nam;<br />
}<br />
<br />
List<person> obj = new List<person>();<br />
obj.Add(new person("abc",22));<br />
obj.Add(new person("ggbc1",23));<br />
obj.Add(new person("ccc2",10));<br />
obj.Add(new person("cabc3",12));<br />
obj.Add(new person("bbbc4", 6));<br />
<br />
obj.Find(delegate(person p) { return p.age = 12; });
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
and the problem is...... ???
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Problem is the following line of code.
There is accuring an error.
argument 1 cannot convert form annonymous method 1o predicate <person>
obj.Find(delegate(person p) { return p.age = 12; });
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
I guessed that, it's just that, like always, you're guessing how the code should look instead of doing research, and making posts that don't give half way enough information to help people to help you.
public class person
{
public string name;
public int age;
public person(string nam , int ag)
{
this.age = ag;
this.name = nam;
}
}
public class Program
{
public static void Main(string[] args)
{
List<person> obj = new List<person>();
obj.Add(new person("abc",22));
obj.Add(new person("ggbc1",12));
obj.Add(new person("ccc2",10));
obj.Add(new person("cabc3",12));
obj.Add(new person("bbbc4", 6));
Predicate<person> exists = delegate(person p1)
{
return p1.age == 12;
};
person p = obj.Find(exists);
}
}
}
Note that find will only return one object, you can use FindAll to get a list back.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: and the problem is...... ???
... the missing of the ability to learn from past experience... even after 1100+ posts...
|
|
|
|
|
Sonia - what error is the compiler returning? I'll give you a hint - you should use == not = in the check, but the compiler would have told you this.
You have to learn how to interpret compiler errors rather than reaching for CodeProject as soon as you get an error you've not seen before. This and the error you posted below could both have been found with a little bit of effort and research on your part.
|
|
|
|
|
Problem is the following line of code.
There is accuring an error.
argument 1 cannot convert form annonymous method to predicate
obj.Find(delegate(person p) { return p.age = 12; });
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Sonia - I've already told you what the answer is. Read the full text above.
|
|
|
|
|
Sonia - I thought that I would see whether Google would have been able to answer your question. You know what? The first entry in the list matched your problem exactly. Why not try reaching for google rather than using us to help you compile your code? It'll help you become a better developer in the long run.
|
|
|
|
|
can i use two filters in the find statement , according to there should not be two return statements in a single block.
But i have to set two where conditions to refine the record.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Wow - you didn't listen to a thing he said, did you ?
You have a function that returns bool. It's up to you, through the writing of actual code, to decide when that is true, or false. It can depend on as many different conditions as you like.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
This time , i think u did not care to look the question carefully.
the new question has nothing to do with the prior one.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|