Errors when compiling, any ideas??

Discussion in 'Microsoft ASP .NET' started by brin, Jun 28, 2004.

  1. brin

    brin Guest

    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
     
    brin, Jun 28, 2004
    #1
    1. Advertisements

  2. brin

    Patrice Guest

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

    Patrice

    --

    "brin" <> a écrit dans le message de
    news:DdUDc.1166$...
    > 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
    >
    >
     
    Patrice, Jun 28, 2004
    #2
    1. Advertisements

  3. brin

    Hans Kesting Guest

    "brin" <> wrote in message news:DdUDc.1166$...
    > 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
     
    Hans Kesting, Jun 28, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: Microsoft ASP .NET
    Replies:
    2
    Views:
    407
    Mark Goldin
    Jan 17, 2004
  2. Guest

    Error message - any ideas?

    Guest, May 5, 2004, in forum: Microsoft ASP .NET
    Replies:
    2
    Views:
    178
    Guest
    May 5, 2004
  3. David Hearn
    Replies:
    2
    Views:
    278
    Lau Lei Cheong
    Jun 24, 2004
  4. Joe via DotNetMonster.com

    Errors when Compiling a Class File

    Joe via DotNetMonster.com, Mar 16, 2005, in forum: Microsoft ASP .NET
    Replies:
    3
    Views:
    267
    Matt Berther
    Mar 16, 2005
  5. Paul Taylor

    Errors when pre-compiling ASP.NET 2.0 site

    Paul Taylor, Nov 4, 2006, in forum: Microsoft ASP .NET
    Replies:
    1
    Views:
    336
    Paul Taylor
    Nov 4, 2006
Loading...

Share This Page