[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.dotnet.framework.odbcnet

odbc.net not working with asp.net

Debby Quock

9/26/2002 4:22:00 PM

Has anyone has problems or success with using ODBC.NET
with ASP.NET? I successfully installed ODBC.NET, and
checked that the namespace "Microsoft.Data.Odbc" did
indeed make its way into the global assembly cache (by
using the Visual Studio.NET gacutil.exe at the command
prompt). When I run the aspx file below from Internet
Explorer, I get the error message that "OdbcConnection
type is not defined", and also "Microsoft.Data.Odbc"
cannot be found during the import statement. I am not
sure why the aspx compiler cannot see the namespace
Microsoft.Data.Odbc. Is there other code that must be
included in the aspx file to be able to use ODBC.NET?

Thanks for all and and help,

Debby


-->
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="Microsoft.Data.Odbc" %>
<%@ Page aspcompat=true Language=VB Debug=true %>

<HTML>
<HEAD>
<TITLE>ACS034 - ASP.NET Database Connection
Test</TITLE>
</HEAD>
<Script Language=VB Runat=Server>

Sub Page_Load(Sender As Object, e As EventArgs)

dim MyConnection As OdbcConnection
dim MyCommand As OdbcDataAdapter
dim MyDataset As DataSet
dim MyTable As DataTable
dim loop1, numrows As Integer
dim sqlstr As String

sqlstr = "SELECT BPM.DEVICE_NAME FROM BPM"

'Create a connection to the data source...

MyConnection = New OdbcConnection
("DSN=XXXXX;UID=xxxxxxxx;PWD=xxxxxxxx")

MyConnection.Open()

Response.Write("<p>Connection to ATLAS5
Opened...")

MyCommand = New OdbcDataAdapter(sqlstr,
MyConnection)

Response.Write("<p> Retrieve Oracle Rdb
Table BPM records...<p>")

'Fill a DataSet with data returned from the
database...
MyDataset = New DataSet
MyCommand.Fill(MyDataset)

MyTable = New DataTable
MyTable = MyDataset.Tables(0)


MyConnection.Close
Response.Write("<p>Connection to ATLAS5
Closed")
End Sub

</Script>
</HTML>

1 Answer

(Hussein Abuthuraya(MSFT))

9/27/2002 1:41:00 AM

0

That's a known problem and FAQ on this newsgroup. Here is the answer:

PRB: Err Msgs When You Use ODBC .NET Data Provider in WebForm
ID: Q318917
http://support.microsoft.com/default.aspx?scid=kb;en-...

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....