Home All Groups Group Topic Archive Search About
Author
24 Mar 2006 3:49 PM
christof
Is there a way do programmable get a Collation list from server?
Tried this:

[C# code]
using Microsoft.SqlServer.Management.Smo;

Server srv = ...;
DataTable collations = srv.EnumCollations();

but it returns an empty DataTable, i wish to fetch it somehow.

SELECT *
FROM ::fn_helpcollations()

it works fine from sqlcmd shell, how to do it in C#?
I know in DMO there was a method ListCollations(), but I wish to use
either Smo or sql commands,

thanks

Author
25 Mar 2006 5:00 AM
Ciprian Gerea [MSFT]
Hi Christof,

It looks like a bug in our code, this function is supposed to do what you
need. Can you give us more details about your code? What else are you doing
before trying to enumerate the collations?

--
Ciprian Gerea
SDE, SqlServer

This posting is provided "AS IS" with no warranties, and confers no rights.


Show quote
"christof" <nom***@nomail.de> wrote in message
news:O4OXwp1TGHA.4976@TK2MSFTNGP11.phx.gbl...
> Is there a way do programmable get a Collation list from server?
> Tried this:
>
> [C# code]
> using Microsoft.SqlServer.Management.Smo;
>
> Server srv = ...;
> DataTable collations = srv.EnumCollations();
>
> but it returns an empty DataTable, i wish to fetch it somehow.
>
> SELECT *
> FROM ::fn_helpcollations()
>
> it works fine from sqlcmd shell, how to do it in C#?
> I know in DMO there was a method ListCollations(), but I wish to use
> either Smo or sql commands,
>
> thanks
Author
25 Mar 2006 5:55 AM
oj
bug? I just tried it and it returned the list just fine.


Server srv = new Server();
foreach (DataRow r in srv.EnumCollations().Rows)
{
System.Diagnostics.Debug.WriteLine(r["Name"]);
}

'ConsoleApplicationSMODemo.vshost.exe' (Managed): Loaded
'C:\WINDOWS\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just
My Code' is enabled.
'ConsoleApplicationSMODemo.vshost.exe' (Managed): Loaded
'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll',
Skipped loading symbols. Module is optimized and the debugger option 'Just
My Code' is enabled.
Albanian_BIN
Albanian_BIN2
Albanian_CI_AI
Albanian_CI_AI_KS
....

--
-oj



Show quote
"Ciprian Gerea [MSFT]" <Ciprian.Ge***@online.microsoft.com> wrote in message
news:eBP0%23j8TGHA.4900@TK2MSFTNGP12.phx.gbl...
> Hi Christof,
>
> It looks like a bug in our code, this function is supposed to do what you
> need. Can you give us more details about your code? What else are you
> doing before trying to enumerate the collations?
>
> --
> Ciprian Gerea
> SDE, SqlServer
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "christof" <nom***@nomail.de> wrote in message
> news:O4OXwp1TGHA.4976@TK2MSFTNGP11.phx.gbl...
>> Is there a way do programmable get a Collation list from server?
>> Tried this:
>>
>> [C# code]
>> using Microsoft.SqlServer.Management.Smo;
>>
>> Server srv = ...;
>> DataTable collations = srv.EnumCollations();
>>
>> but it returns an empty DataTable, i wish to fetch it somehow.
>>
>> SELECT *
>> FROM ::fn_helpcollations()
>>
>> it works fine from sqlcmd shell, how to do it in C#?
>> I know in DMO there was a method ListCollations(), but I wish to use
>> either Smo or sql commands,
>>
>> thanks
>
>
Author
25 Mar 2006 5:50 AM
oj
EnumCollations works just fine.

Server srv = new Server();

foreach (DataRow r in srv.EnumCollations().Rows)

{

Console.WriteLine(r["Name"]);



}


--
-oj



Show quote
"christof" <nom***@nomail.de> wrote in message
news:O4OXwp1TGHA.4976@TK2MSFTNGP11.phx.gbl...
> Is there a way do programmable get a Collation list from server?
> Tried this:
>
> [C# code]
> using Microsoft.SqlServer.Management.Smo;
>
> Server srv = ...;
> DataTable collations = srv.EnumCollations();
>
> but it returns an empty DataTable, i wish to fetch it somehow.
>
> SELECT *
> FROM ::fn_helpcollations()
>
> it works fine from sqlcmd shell, how to do it in C#?
> I know in DMO there was a method ListCollations(), but I wish to use
> either Smo or sql commands,
>
> thanks
Author
25 Mar 2006 2:47 PM
christof
oj wrote:
> EnumCollations works just fine.
>
> Server srv = new Server();
>
> foreach (DataRow r in srv.EnumCollations().Rows)
>
> {
>
> Console.WriteLine(r["Name"]);
>
>
>
> }

Thank you very much, works fine now for me too!
Mistake I've made was here:
DataTable collations = srv.EnumCollations();
I thought it would fetch my DataTable, I didn't do enumeration.
foreach(.... )

AddThis Social Bookmark Button