Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / October 2005

Tip: Looking for answers? Try searching our database.

Compiling dlls with vbc.exe

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
martinharvey - 17 Oct 2005 05:57 GMT
I would be really grateful if somone can  help me with this:

I am trying to compile a dll from the commnd line with the following code:

vbc /debug /nologo /t:library /out:\worldshopdevelopement\bin\Catalog.dll /r:
System.dll /r:System.Data.dll  \worldshopdevelopement\Catalog.vb

The vbc compiler is returning the message:

C:\worldshopdevelopement\Catalog.vb(11) : error BC30451: ?? 'CommandType' ????
??
?????

       command.CommandType = CommandType.StoredProcedure
                             ~~~~~~~~~~~
C:\worldshopdevelopement\Catalog.vb(15) : error BC30451: ?? 'CommandBehavior'
??
?????????

       Return command.ExecuteReader(CommandBehavior.CloseConnection)
                                    ~~~~~~~~~~~~~~~
C:\worldshopdevelopement\Catalog.vb(20) : error BC30451: ??
'ConfigurationSettin
gs' ???????????

           Return ConfigurationSettings.AppSettings("ConnectionString")

Would be really grateful if someone could tell me where i am going wrong

Many Thanks

Martin

For reference the .vb page is as follows:

Imports System.Data.SqlClient
Public Class Catalog
   Public Shared Function SP_GetBB() As SqlDataReader
       ' Create the connection object
       Dim connection As New SqlConnection(connectionString)
       ' Create and initialize the command object
       Dim command As New SqlCommand("SP_GetBB", connection)
       command.CommandType = CommandType.StoredProcedure
       ' Open the connection
       connection.Open()
       ' Return a SqlDataReader to the calling function
       Return command.ExecuteReader(CommandBehavior.CloseConnection)
   End Function

   Private Shared ReadOnly Property connectionString() As String
       Get
           Return ConfigurationSettings.AppSettings("ConnectionString")
       End Get
   End Property
End Class
Richard Grimes - 17 Oct 2005 15:46 GMT
> I would be really grateful if somone can  help me with this:
> C:\worldshopdevelopement\Catalog.vb(20) : error BC30451: ??
> 'ConfigurationSettin
> gs' ???????????

You're missing the appropriate Imports for the namespaces of the classes
that are being marked as an error. For example, for the error above you
must either explicitly call:

System.Diagnostics.ConfigurationSettings.AppSettings("ConnectionString")

or add a line:

Imports System.Diagnostics

Richard
Signature

http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm

martinharvey - 18 Oct 2005 09:42 GMT
>> I would be really grateful if somone can  help me with this:
>> C:\worldshopdevelopement\Catalog.vb(20) : error BC30451: ??
[quoted text clipped - 12 lines]
>
>Richard

Dear Richard

Thank you for your help with this.

I have tried adding "Imports System.Diagnostics"  to the vb page. How do i
reference this on the command line?. I have tried using /r: System.
Diagnostics.dll but  I get a 2017 compile error.

Do  you have any thoughts about this and what do you think the missing
namespace could be for the "Command" error.

Once again many thaks for your help.

Martin
Richard Grimes - 18 Oct 2005 12:07 GMT
> I have tried adding "Imports System.Diagnostics"  to the vb page. How
> do i reference this on the command line?. I have tried using /r:
> System. Diagnostics.dll but  I get a 2017 compile error.

Ah, now I see what the problem is.

Unfortunately Microsoft have confused issues with the names of their
assemblies - they appear to look as if they are named after namespaces,
but this is not correct. A namespace is just a prefix to the name of a
class, it has no bearing on the assembly where a class is defined. In
fact, an assembly can have types of several namespaces, and types of the
same namespace can be defined in several assemblies.

Most of the classes in System.Diagnostics are in the system.dll
assembly, there is no System.Diagnostics.dll assembly. However, the only
way to know for sure is to look up the class in the documentation.

> Do  you have any thoughts about this and what do you think the missing
> namespace could be for the "Command" error.

SqlCommand is in the System.Data.SqlClient namespace and is defined in
the system.data.dll assembly.

http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemDataSqlClientSqlCo
mmandClassTopic.asp?frame=true


Richard
Signature

http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm

martinharvey - 19 Oct 2005 09:29 GMT
>> I have tried adding "Imports System.Diagnostics"  to the vb page. How
>> do i reference this on the command line?. I have tried using /r:
[quoted text clipped - 22 lines]
>
>Richard

Thank you for your patience with this Richard

I am referencing both the system.data.dll  and system.dll  in the command
line as well as Imports System.Diagnostics in the .vb page but i am still
getting the same error i mentioned in my first query.

I am pulling my hair out with this

Any further thoughts

Thank you

Martin
Richard Grimes - 19 Oct 2005 14:28 GMT
> Thank you for your patience with this Richard
>
[quoted text clipped - 5 lines]
>
> Any further thoughts

Yes, sorry I should have tried to compile the code myself. Now I have
done, here's how I got it to compile.

You need Imports for System.Data, System.Data.SqlClient and
System.Configuration.

You need to reference two assemblies on the command line:
system.data.dll and system.dll

Finally, the connectionString is not defined anywhere. So either make it
a parameter of the function, or make it a constant.

Richard
Signature

http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm

martinharvey - 20 Oct 2005 09:46 GMT
>> Thank you for your patience with this Richard
>>
[quoted text clipped - 15 lines]
>
>Richard

Thank you once again Richard

I had tried the above combination before and got the same error . I think you
are right about defining the
connection string.

The connection string i have in the web file app settings is;

<add key="ConnectionString"
value="server=localhost;Trusted_Connection=true;database=worldshop" />

What would the exact syntax be for making this a constant or a parameter of
the function.

many thanks

martin
Richard Grimes - 20 Oct 2005 22:11 GMT
> I had tried the above combination before and got the same error . I
> think you are right about defining the
[quoted text clipped - 4 lines]
> <add key="ConnectionString"
> value="server=localhost;Trusted_Connection=true;database=worldshop" />

If it is in <appSettings> then you should read it from there:

Dim connection_string As String
connection_string =
ConfigurationSettings.AppSettings("ConnectionString")

Richard
Signature

http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm

martinharvey - 23 Oct 2005 08:08 GMT
>> I had tried the above combination before and got the same error . I
>> think you are right about defining the
[quoted text clipped - 9 lines]
>
>Richard

Just a quick note to let you know i got it working

many many thanks for your help with this Richard

martin

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.