I'm trying to use SQLDMO from a C# console app and I was told to do the
following to create a wrapper for the COM lib:
> tlbimp sqldmo.dll /out:sqldmonet.dll
I ran this, and sure enough it generated a 946K DLL file.
If I then try and compile it into my console app:
> csc /target:exe /debug:full /reference:sqldmonet.dll vfupdate.cs
I get the following error:
vfupdate.cs(20,7): error CS0246: The type or namespace name 'SQLDMO' could
not be found (are you missing a using directive or an assembly reference?)
...which comes from the line "using SQLDMO;"
Why can't it see the SQLDMO namespace? If I add /namespace:SQLDMO to the
tlbimp command, it then compiles OK, but I can't actually create the
required __SQLServer object.
Any ideas?
Nick...
(please reply to newsgroup where possible)
tlbimp sqldmo.dll /out:sqldmonet.dll /namespace:SQLDMO
and it should work as you expect. SQLDMO is the default namespace when you
add a COM reference using Visual Studio, because it uses the same name for
the runtime callable wrapper as the originating DLL, hence SQLDMO
Ge...@SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright © SQLDev.Net 1991-2002 All rights reserved.
"Nick Gilbert" <nickg@@technologist.com> wrote in message
news:u1UlaoTRCHA.1632@tkmsftngp11...
If I use your line to create the DLL:
> tlbimp sqldmo.dll /out:sqldmonet.dll /namespace:SQLDMO
...and your example code from here:
http://groups.google.com/groups?selm=ObGzDNGvAHA.1832%40tkmsftngp05
I get the following errors when I compile:
> csc /reference:sqldmonet.dll backuptest.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.
backuptest.cs(15,13): error CS0246: The type or namespace name '__SQLServer'
could not be found (are you missing a usin
directive or an assembly reference?)
backuptest.cs(19,13): error CS0246: The type or namespace name '__Backup'
could not be found (are you missing a using
directive or an assembly reference?)
backuptest.cs(20,13): error CS0246: The type or namespace name 'server'
could not be found (are you missing a using
directive or an assembly reference?)
backuptest.cs(21,13): error CS0246: The type or namespace name 'server'
could not be found (are you missing a using
directive or an assembly reference?)
backuptest.cs(22,45): error CS0246: The type or namespace name 'server'
could not be found (are you missing a using
directive or an assembly reference?)
backuptest.cs(23,25): error CS0246: The type or namespace name 'server'
could not be found (are you missing a using
directive or an assembly reference?)
backuptest.cs(26,13): error CS0246: The type or namespace name 'backup'
could not be found (are you missing a using
directive or an assembly reference?)
backuptest.cs(27,13): error CS0246: The type or namespace name 'backup'
could not be found (are you missing a using
directive or an assembly reference?)
I really don't understand...
Nick...
"Gert E.R. Drapers" <Ge...@SQLDev.Net> wrote in message
news:umsuAsYRCHA.2648@tkmsftngp08...
> By the fact that you used /out:sqldmonet.dll the namespace became
sqldmonet.
> Add /namespace:SQLDMO to the command like
>
> tlbimp sqldmo.dll /out:sqldmonet.dll /namespace:SQLDMO
>
> and it should work as you expect. SQLDMO is the default namespace when you
> add a COM reference using Visual Studio, because it uses the same name for
> the runtime callable wrapper as the originating DLL, hence SQLDMO
>
> Ge...@SQLDev.Net
>