I'm running into a weird problem using pretty much standard code that I've used in dozens of other projects with no problem. It compiles fine but when I run in debug on localhost I get a compile error. I'm on a Windows7 thin client with VS2010 but I've
used this code in several other projects in the same dev environment.
Compiler Error Message: BC30002: Type 'DataTable' is not defined.
Source Error:
Line 9: cn = New OracleConnection("Data Source=" & HttpContext.Current.Application("sDataBase") & "; User Id=" & HttpContext.Current.Session("UserID") & "; Password=" & HttpContext.Current.Session("Password") & "; Pooling=False;")
Line 10: End Sub
Line 11: Function GetBin() As DataTable Line 12: Dim SQL As String
Line 13: cn = New OracleConnection(HttpContext.Current.Session("ConnectString"))
I'm not even going to get into how idiotic it is to get a compile error after a successful compile with no errors. Anyone have any ideas what the problem is? My relevant source code is here:
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class TBINData
Implements IDisposable
Dim cn As OracleConnection
Public IsDisposed As Boolean = False
Public Sub New()
cn = New OracleConnection("Data Source=" & HttpContext.Current.Application("sDataBase") & "; User Id=" & HttpContext.Current.Session("UserID") & "; Password=" & HttpContext.Current.Session("Password") & "; Pooling=False;")
End Sub
Function GetBin() As DataTable
Dim SQL As String
cn = New OracleConnection(HttpContext.Current.Session("ConnectString"))
SQL = "Select * From BIN"
Dim da As New OracleDataAdapter(SQL, cn)
Dim dt As New DataTable
da.Fill(dt)
Return dt
SQL = Nothing
End Function
That wasn't the problem but I think that I remember BIN being a reserved word in the older Oracle versions. Now they spell out BINARY so that didn't trip me up this time.
kraznodar
Contributor
3336 Points
889 Posts
Problem with VS2010 suddenly not knowing what a DataTable is.
May 17, 2012 02:09 PM|LINK
Hello everyone,
I'm running into a weird problem using pretty much standard code that I've used in dozens of other projects with no problem. It compiles fine but when I run in debug on localhost I get a compile error. I'm on a Windows7 thin client with VS2010 but I've used this code in several other projects in the same dev environment.
Compiler Error Message: BC30002: Type 'DataTable' is not defined.
Source Error:
Line 9: cn = New OracleConnection("Data Source=" & HttpContext.Current.Application("sDataBase") & "; User Id=" & HttpContext.Current.Session("UserID") & "; Password=" & HttpContext.Current.Session("Password") & "; Pooling=False;") Line 10: End Sub Line 11: Function GetBin() As DataTableLine 12: Dim SQL As String Line 13: cn = New OracleConnection(HttpContext.Current.Session("ConnectString"))
I'm not even going to get into how idiotic it is to get a compile error after a successful compile with no errors. Anyone have any ideas what the problem is? My relevant source code is here:
Imports Oracle.DataAccess.Client
Imports Oracle.DataAccess.Types
Public Class TBINData
Implements IDisposable
Dim cn As OracleConnection
Public IsDisposed As Boolean = False
Public Sub New()
cn = New OracleConnection("Data Source=" & HttpContext.Current.Application("sDataBase") & "; User Id=" & HttpContext.Current.Session("UserID") & "; Password=" & HttpContext.Current.Session("Password") & "; Pooling=False;")
End Sub
Function GetBin() As DataTable
Dim SQL As String
cn = New OracleConnection(HttpContext.Current.Session("ConnectString"))
SQL = "Select * From BIN"
Dim da As New OracleDataAdapter(SQL, cn)
Dim dt As New DataTable
da.Fill(dt)
Return dt
SQL = Nothing
End Function
Web.config looks like this;
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="Oracle.DataAccess, Version=4.112.2.0, Culture=neutral, PublicKeyToken=89B483F429C47342"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Any help is greatly appreciated, thanks!
urenjoy
Star
13465 Points
2022 Posts
Re: Problem with VS2010 suddenly not knowing what a DataTable is.
May 17, 2012 02:37 PM|LINK
Try to import data namespace
Imports System.Data
Lannie
Contributor
3840 Points
749 Posts
Re: Problem with VS2010 suddenly not knowing what a DataTable is.
May 17, 2012 02:38 PM|LINK
BIN might be a RESERVED WORD in Oracle and causes problems in various circumstances.
Oracle ODP.NET often wants the SCHEMANAME with database object names.
Like MYSCHEMA.MYTABLE, MYSCHEMA.MYSEQUENCE, MYSCHEMA.MYPACKAGE.
kraznodar
Contributor
3336 Points
889 Posts
Re: Problem with VS2010 suddenly not knowing what a DataTable is.
May 17, 2012 03:07 PM|LINK
Apparently the Oracle.Types namespace no longer includes DataTable. The funny thing is that my other projects still compile and run just fine.
kraznodar
Contributor
3336 Points
889 Posts
Re: Problem with VS2010 suddenly not knowing what a DataTable is.
May 17, 2012 03:10 PM|LINK
That wasn't the problem but I think that I remember BIN being a reserved word in the older Oracle versions. Now they spell out BINARY so that didn't trip me up this time.