Compiler Error Message: BC30466: Namespace or type 'Odbc' for the Imports 'Micro

Compiler Error Message: BC30466: Namespace or type 'Odbc' for the Imports 'Micro

Post by Jona » Fri, 26 Apr 2002 20:10:43



Why do I get this error:
Compiler Error Message: BC30466: Namespace or type 'Odbc'
for the Imports 'Microsoft.Data.Odbc' cannot be found.

I've added a reference to Microsoft.Data.Odbc in my
asp.net project.

aspx page
===================

Inherits="VbTutor1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<html>
        <head>
                <title>WebForm1</title>
                <meta name="GENERATOR" content="Microsoft
Visual Studio.NET 7.0">
                <meta name="CODE_LANGUAGE" content="Visual
Basic 7.0">
                <meta name="vs_defaultClientScript"
content="JavaScript">
                <meta name="vs_targetSchema"
content="http://www.veryComputer.com/;>
        </head>
        <body MS_POSITIONING="GridLayout">
         <form action="WebForm1.aspx" method="post"
runat="server" ID="Form1">

                <asp:DataGrid ID="cases">
                        <Columns>
                                <asp:BoundColumn
DataField="name"></asp:BoundColumn>
                                <asp:BoundColumn
DataField="caseid"></asp:BoundColumn>
                        </Columns>
                </asp:DataGrid>
        </form>
        </body>
</html>

.vb page
===================================
Imports Microsoft.Data.Odbc
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Public Class WebForm1
    Inherits System.Web.UI.Page

    Public cases As DataGrid

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.De*StepThrough()> Private Sub
InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web
Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim cmd As OdbcCommand
        Dim sql As String = "SELECT name,caseid FROM
case_info"
        Dim conStr As String = "driver=
{MySQL};server=sql3;uid=root;database=support3;OPTION=17923
"

        Dim da As OdbcDataAdapter = New OdbcDataAdapter
(sql, conStr)
        Dim ds As New DataSet()

        da.Fill(ds, "case_info")
        'dim bldr as

        Dim dt As DataTable = ds.Tables(0)

        cases.DataSource = dt
        cases.databind()

    End Sub

End Class

 
 
 

Compiler Error Message: BC30466: Namespace or type 'Odbc' for the Imports 'Micro

Post by Ken Cox [Microsoft MVP » Sat, 27 Apr 2002 10:39:40


Are you working with an old beta? Did you intend to use this?

Imports System.Data.OleDb

I notice that you are hooking up to MySQL. Is it supported?

Ken


Why do I get this error:
Compiler Error Message: BC30466: Namespace or type 'Odbc'
for the Imports 'Microsoft.Data.Odbc' cannot be found.

I've added a reference to Microsoft.Data.Odbc in my
asp.net project.

aspx page
===================

Inherits="VbTutor1.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft
Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual
Basic 7.0">
<meta name="vs_defaultClientScript"
content="JavaScript">
<meta name="vs_targetSchema"
content="http://www.veryComputer.com/;>
</head>
<body MS_POSITIONING="GridLayout">
<form action="WebForm1.aspx" method="post"
runat="server" ID="Form1">

<asp:DataGrid ID="cases">
<Columns>
<asp:BoundColumn
DataField="name"></asp:BoundColumn>
<asp:BoundColumn
DataField="caseid"></asp:BoundColumn>
</Columns>
</asp:DataGrid>
</form>
</body>
</html>

.vb page
===================================
Imports Microsoft.Data.Odbc
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls

Public Class WebForm1
    Inherits System.Web.UI.Page

    Public cases As DataGrid

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.De*StepThrough()> Private Sub
InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web
Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dim cmd As OdbcCommand
        Dim sql As String = "SELECT name,caseid FROM
case_info"
        Dim conStr As String = "driver=
{MySQL};server=sql3;uid=root;database=support3;OPTION=17923
"

        Dim da As OdbcDataAdapter = New OdbcDataAdapter
(sql, conStr)
        Dim ds As New DataSet()

        da.Fill(ds, "case_info")
        'dim bldr as

        Dim dt As DataTable = ds.Tables(0)

        cases.DataSource = dt
        cases.databind()

    End Sub

End Class

 
 
 

1. The Namespace or type 'test' for the Import 'test' cannot be found.

I've got a simple web page default.aspx with a:


statement. When i run it, i get this error:

---
Compiler Error Message: BC30466: The Namespace or type 'test' for the Import
'test' cannot be found.
Source Error:
Line 28: Imports System.Web.UI.HtmlControls
Line 29: Imports System.Web.UI.WebControls
Line 30: Imports test
Line 31:
Line 32: Namespace ASP
Source File: c:\WINNT\Microsoft.NET\Framework\v1.0.2914\Temporary ASP.NET
Files\testApp\87dc9c1f\d8606262\5afp9arj.0.vb    Line: 30
---

I have a class1.vb in this project that has the following:
---
Namespace test
    Public Class clsTest
        Public Sub New()
            MyBase.New()
        End Sub
        Public Function one(ByVal parm1IN As Integer) As String
            Return "It worked."
        End Function
    End Class
End Namespace
---

I'm NOT even declaring or calling the class yet. I get the error JUST from
the import statement.

The default.aspx and class1.vb are in the same folder. If i remove the
import statement, the page works, but I'm trying to learn how to encapsulate
business logic into namespaces and classes.

Do i need to compile class1.vb outside Interdev (B2SP2) or put an add
assembly line in the config.web?

Any ideas are appreciated?

Brent

2. VPN for Macintoshes

3. Compiler Error Message: BC30002: Type is not defined: 'OdbcConnection'

4. HP 5P Program Error?

5. Compiler Error Message: BC30002: Type ' ' is not defined.

6. MSN 5.1 Uninstall Unforgivable Sin

7. Compiler Error Message: BC30002: Type 'Collection' is not defined.

8. sendmail on a VPN

9. ODBC driver error '80004005' - couldn't find file '(unknown)'

10. Error - Cast from type 'DBNull' to type 'String' is not valid

11. Error:'ConnectionClass' is ambiguous in the namespace 'ADODB'

12. Compiler Error Message: BC30456: 'CreateResourceBasedLiteralControl'

13. Compiler Error Message: BC32400: Class 'CLSID_CorSymWriter' could not be created: Class not registered