[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Compiler Error Message: BC30002: Type 'Microsoft.data.Odbc.OdbcConnection' is no

rikkie

8/12/2002 7:32:00 PM

I got this error code Compiler Error Message: BC30002:
Type 'Microsoft.data.Odbc.OdbcConnection' is not defined.

Using this asp.net code anyone who can tell me what´s wrong

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="Microsoft.Data.Odbc" %>
<script runat="server">

Sub Page_Load(Sender As Object, E As EventArgs)

' TODO: Update the ConnectionString and
CommandText values for your application
Dim ConnectionString As String = "DSN=FREIGHTWARE"
Dim CommandText As String = "select RELATIONCODE
FROM RELATION"

Dim myConnection As New
Microsoft.data.Odbc.OdbcConnection(ConnectionString)
Dim myCommand As New OdbcCommand(CommandText,
myConnection)

myConnection.Open()

DataGrid1.DataSource = myCommand.ExecuteReader
(CommandBehavior.CloseConnection)
DataGrid1.DataBind()

End Sub

</script>
<html>
<head>
</head>
<body style="FONT-FAMILY: arial">
<h2>Simple Data Report
</h2>
<hr size="1" />
<form runat="server">
<asp:datagrid id="DataGrid1" runat="server"
CellSpacing="1" GridLines="None" CellPadding="3"
BackColor="White" ForeColor="Black"
EnableViewState="False">
<HeaderStyle font-bold="True"
forecolor="white" backcolor="#4A3C8C"></HeaderStyle>
<ItemStyle backcolor="#DEDFDE"></ItemStyle>
</asp:datagrid>
</form>
</body>
</html>

3 Answers

(Hussein Abuthuraya(MSFT))

8/13/2002 3:20:00 AM

0

Rikkie,

You need to add one more line to identify the location of the ODBC Dll for the compiler before importing the name space:

<%@ CompilerOptions='/R:"C:\Program Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"' %>
<%@ Import Namespace = "Microsoft.Data.Odbc" %>


I hope this helps!


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....


rikkie

8/16/2002 11:51:00 AM

0

Hussein,

i needed to place it in the page directives but it worked,
but i use Web Matrix and if you close the files after
saving it looses the specific directive. So can i put it
in the web config and if so how and where do i place it

thnx again
Rikkie


>-----Original Message-----
>Rikkie,
>
>You need to add one more line to identify the location of
the ODBC Dll for the compiler before importing the name
space:
>
><%@ CompilerOptions='/R:"C:\Program
Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"' %>
><%@ Import Namespace = "Microsoft.Data.Odbc" %>
>
>
>I hope this helps!
>
>
>Thanks,
>Hussein Abuthuraya
>Microsoft Developer Support
>
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>
>Are you secure? For information about the Microsoft
Strategic Technology Protection Program and to order your
FREE Security Tool Kit, please visit
>http://www.microsoft.co....
>
>
>.
>

Jonathan Scott

8/27/2002 8:50:00 PM

0

Hussein,

You really seem to have a good grasp on this, so I thought I'd run this
question by you.

I followed an earlier example, either yours or someone elses, about adding a
Reference in VS .Net to the Microsoft.Data.Odbc.dll , and it kept giving me
the same error as Rikkie below. I followed your compile directive, and it
seems to run without errors, so that's good. I too had to put the compile
directive in the <%@ Page %>, otherwise I got an error about only 1 page
directive allowed.

Question is, why do I have to add the Reference in VS. Net, if I have to use
the compile directive anyway? Shouldn't the reference eliminate the need for
all the complicated directives? Seems like that could become a pretty long
list, on a bigger project, if you had to tell the compiler about custom
Dll's manually. Any insight on the Reference topic would be great (ASP going
to ASP .Net developer here, and just switching, so still learning). Thanks!

Regards,

Jonathan Scott
Web Architect
Miniature Precision Components, Inc.
847 Walworth Street
Walworth, WI 53184
(262) 275 - 5791 x 2258

"Hussein Abuthuraya(MSFT)" <HussAbOnline@microsoft.com> wrote in message
news:GsCBzdmQCHA.964@cpmsftngxa10...
> Rikkie,
>
> You need to add one more line to identify the location of the ODBC Dll for
the compiler before importing the name space:
>
> <%@ CompilerOptions='/R:"C:\Program
Files\Microsoft.NET\Odbc.Net\Microsoft.data.odbc.dll"' %>
> <%@ Import Namespace = "Microsoft.Data.Odbc" %>
>
>
> I hope this helps!
>
>
> Thanks,
> Hussein Abuthuraya
> Microsoft Developer Support
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
> Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.co....
>
>