Click here to Skip to main content
15,912,507 members
Home / Discussions / C#
   

C#

 
GeneralRe: set font from string Pin
Xmen Real 23-Dec-07 14:53
professional Xmen Real 23-Dec-07 14:53 
GeneralRe: set font from string Pin
Paul Conrad23-Dec-07 14:59
professionalPaul Conrad23-Dec-07 14:59 
GeneralSql version... Pin
tasumisra18-Dec-07 18:20
tasumisra18-Dec-07 18:20 
GeneralRe: Sql version... Pin
DigiOz Multimedia18-Dec-07 18:48
DigiOz Multimedia18-Dec-07 18:48 
GeneralRe: Sql version... Pin
tasumisra18-Dec-07 20:29
tasumisra18-Dec-07 20:29 
GeneralRe: Sql version... Pin
Stu Richardson19-Dec-07 0:56
Stu Richardson19-Dec-07 0:56 
GeneralRe: Sql version... Pin
tasumisra19-Dec-07 1:07
tasumisra19-Dec-07 1:07 
GeneralRe: Sql version... Pin
Stu Richardson19-Dec-07 1:32
Stu Richardson19-Dec-07 1:32 
I think you should be doing...

SqlCommand cmd = new SqlCommand(@"SELECT SERVERPROPERTY('ProductVersion')", conn);
SqlDataReader myReader = cmd.ExecuteReader()
Console.WriteLine(myReader[0]);

(I havent tested the above code just replaced the sql statement)

That will give you "9.00.xxxx.xx"

Then you can just determine the version using the value 9. So 9 = 2005, 8 = 2000 and you can even go into more detail by easily retrieving the service pack they have installed if you need to.

However if you have to go down the long string route which it seems like you want to then using the array position will work but obviously the biggest flaw is if the strings are in different formats for different versions. (I dont know the answer to that)

Another solution could be using a regular expression to extract a 4 digit string or use the String functions like Contains or IndexOf but this is only useful if you know what you are looking for. i.e. "2000" or "2005".
GeneralRe: Sql version... Pin
tasumisra19-Dec-07 17:34
tasumisra19-Dec-07 17:34 
GeneralRe: Sql version... Pin
Stu Richardson19-Dec-07 21:46
Stu Richardson19-Dec-07 21:46 
QuestionHow to use Clipboard in System.Timers.Timer? Pin
surfingcode18-Dec-07 17:00
surfingcode18-Dec-07 17:00 
AnswerRe: How to use Clipboard in System.Timers.Timer? Pin
TJoe20-Dec-07 3:15
TJoe20-Dec-07 3:15 
Generalstring character checking Pin
azusakt18-Dec-07 16:15
azusakt18-Dec-07 16:15 
GeneralRe: string character checking Pin
PIEBALDconsult18-Dec-07 16:22
mvePIEBALDconsult18-Dec-07 16:22 
GeneralRe: string character checking Pin
azusakt18-Dec-07 17:03
azusakt18-Dec-07 17:03 
Question[Message Deleted] Pin
PeterSchregle18-Dec-07 12:13
PeterSchregle18-Dec-07 12:13 
GeneralRe: Pointers and C# Pin
J$18-Dec-07 12:56
J$18-Dec-07 12:56 
GeneralRe: Pointers and C# Pin
Anthony Mushrow18-Dec-07 16:00
professionalAnthony Mushrow18-Dec-07 16:00 
QuestionSimulating the use of a splitter Pin
Clive D. Pottinger18-Dec-07 11:03
Clive D. Pottinger18-Dec-07 11:03 
GeneralRe: Simulating the use of a splitter Pin
DaveyM6918-Dec-07 11:35
professionalDaveyM6918-Dec-07 11:35 
GeneralRe: Simulating the use of a splitter Pin
Ravi Bhavnani18-Dec-07 11:39
professionalRavi Bhavnani18-Dec-07 11:39 
GeneralRe: Simulating the use of a splitter Pin
Ravi Bhavnani18-Dec-07 11:41
professionalRavi Bhavnani18-Dec-07 11:41 
QuestionHandler for all unhandled exceptions in a class? Pin
alanteigne18-Dec-07 9:47
alanteigne18-Dec-07 9:47 
GeneralRe: Handler for all unhandled exceptions in a class? Pin
eggsovereasy18-Dec-07 10:36
eggsovereasy18-Dec-07 10:36 
GeneralRe: Handler for all unhandled exceptions in a class? Pin
alanteigne18-Dec-07 11:56
alanteigne18-Dec-07 11:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.