Hi all, newbie here and to the world of ASP.NET.
Im using WebMatrix for writing ASPX and
VB files and VBC to compile the
VB files into DLLs.
Im having the following problem when I try to compile a
VB file. I have all the DLL files reference (System.Data.dll, System.dll etc) and considering System.Data.dll should include the NameSpace 'System.Data.SqlClient', Im not sure while it doesnt compile.
I've read the thread
http://p2p.wrox.com/topic.asp?TOPIC_ID=3796 on this forum and made sure Im using the correct syntax and I've put all the VBC, and DLL files needed to compile the
VB files into a folder like the one described at
http://it.maconstate.edu/tutorials/A...pnet15-03.aspx
Any help appreciated!
Regards,
Ray
====== START ======
C:\Web Services>vbc /t:library /out:BooksDB.dll /r:System.dll /r:System.Data.dll /r:System.Web.Services.dll /r:System.XML.dll BooksDB.
vb
Microsoft (R) Visual Basic .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322.573
Copyright (C) Microsoft Corporation 1987-2002. All rights reserved.
C:\Web Services\BooksDB.
vb(52) : error BC30002: Type 'SqlConnection' is not defined.
Dim objConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
~~~~~~~~~~~~~
C:\Web Services\BooksDB.
vb(53) : error BC30002: Type 'SqlCommand' is not defined.
Dim objCmd As SqlCommand = New SqlCommand("sp_Book_Detail2", objConn)
~~~~~~~~~~
C:\Web Services\BooksDB.
vb(56) : error BC30451: Name 'CommandType' is not declared.
objCmd.CommandType = CommandType.StoredProcedure
~~~~~~~~~~~
C:\Web Services\BooksDB.
vb(59) : error BC30002: Type 'SqlParameter' is not defined.
Dim parameterBookID As SqlParameter = New SqlParameter("@BookID", SqlDbType.int, 4)
~~~~~~~~~~~~
====== END ======
======
VB File START ======
Imports System
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Namespace KoganPage.Commerce
'************************************************* ******
'
' BookDetails Class
'
' A simple data class that encapsulates details about
' a particular book inside the Kogan Page
' database.
'
'************************************************* ******
Public Class BookDetails
Public ISBN As String
Public Title As String
Public Description As String
Public PricePound As Decimal
End Class
'************************************************* ******
'
' BooksDB Class
'
' Business/Data Logic Class that encapsulates all data
' logic necessary to query books within
' the Kogan Page database.
'
'************************************************* ******
Public Class BooksDB
'************************************************* ******
'
' BooksDB.GetBookDetails() Method <a name="GetBookDetails"></a>
'
' The GetBookDetails method returns a BookDetails
' struct containing specific details about a specified
' book within the Kogan Page Database.
'
'
'************************************************* ******
Public Function GetBookDetails(ByVal BookID As Integer) As BookDetails
' Create Instance of Connection and Command Object
Dim objConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("C onnectionString"))
Dim objCmd As SqlCommand = New SqlCommand("sp_Book_Detail2", objConn)
' Mark the Command as a SPROC
objCmd.CommandType = CommandType.StoredProcedure
' Add Parameters to SPROC
Dim parameterBookID As SqlParameter = New SqlParameter("@BookID", SqlDbType.int, 4)
parameterBookID.Value = BookID
objCmd.Parameters.Add(parameterBookID)
' Open the connection and execute the Command
objConn.Open()
objCmd.ExecuteNonQuery()
objConn.Close()
' Create and Populate BookDetails Struct using
' Output Params from the SPROC
Dim objBookDetails As BookDetails = New BookDetails()
objBookDetails.ISBN = "1"
objBookDetails.Title = "2"
objBookDetails.Description = "3"
objBookDetails.PricePound = "4"
Return objBookDetails
End Function
End Class
End Namespace
======
VB File END ======