Errors when compiling, any ideas??

  • Thread starter Thread starter brin
  • Start date Start date
B

brin

I have the following vb class and am trying to compile it using vbc.exe. I
receive errors stating that System.Data and System.Data.SqlClient cannot be
imported. I am fairly new to this, any help would be gratefully recieved.

Imports System
Imports System.Data.SqlClient
Imports System.Data
Imports System.Configuration

Namespace DBConnect

Public Class connect

protected conn as SqlConnection

Public Sub New()
conn = New SqlConnection(
"Server=localhost;uid=name;pwd=pass;database=db" )
End Sub

protected sub openConn()
conn.open()
end sub

protected sub closeConn()
conn.close()
end sub

End Class
End Namespace

Cheers

Brin
 
It is likely tou don't have a reference to the System.Data.dll. See the /r
option.

Patrice
 
brin said:
I have the following vb class and am trying to compile it using vbc.exe. I
receive errors stating that System.Data and System.Data.SqlClient cannot be
imported. I am fairly new to this, any help would be gratefully recieved.

Imports System
Imports System.Data.SqlClient
Imports System.Data
Imports System.Configuration

You not only need an "Imports" statement ("using" in C#),
you also need to add a reference to System.Data to your project.

(to be a bit more precise: you don't really *need* that "Imports",
you can also type the complete namespace-path, but even then
you *need* to add the reference)

Hans Kesting
 
Back
Top