0

I've been asked to update an old VB.NET web application and this is not the technology i'm the most comfortable with, being more a desktop guy. Anyway, i'n trying to deal with it!

I'm facing a problem I can't solve (please forgive me if the question is weird). First of all, the code works well in production as this is the client source code. It also works well in VS when i launch the site in debug mode. As soon as I publish the website to my local IIS, the page fails

The App_Code folder contains a Database.vb files, containing a Database class, with the following method :

Option Strict On
Imports System.Text
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.Caching
Imports System.Collections

Public Class Database

    Public Shared Sub ExecuteDataTable(ByVal strSQL As String, ByRef dt As DataTable)
        ...
    End SUb

I have an ASPX page containing the following code

<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        LoadGrid()
    End Sub

    Private Sub LoadGrid()
        Dim strSQL As String = "sp_XXXXXXXXXXXXXXXXXXX"
        Dim dt As New System.Data.DataTable
        Database.ExecuteDataTable(strSQL, dt)
        grd_Data.DataSource = dt
        grd_Data.DataBind()
    End Sub
</script>

Everything works fine in local debug but as soon as I publish the website on my local IIS7 i get this error :

Server Error in '/' Application.
Compilation Error
Compiler Error Message: BC30456: 'Database' is not a member of '<Default>'.
Line 18:         Global.Database.ExecuteDataTable(strSQL, dt)

Notes :

  • The database class is used everywhere in the project and works fine. only difference I noticed here is that the code is in the aspx file using the script runat="server" instead of the usual .vb file. Not sure it causes the issue as it works well running locally.

  • I tried to use Global.Database on line 18 but came through the same issue.

  • The target framework of the solution is v4.0. The application pool in IIS7 is also set to v4.0

Any idea/lead to help me to solve this issue will be greatly appreciated :)

Thanks in advance!

4

1 回答 1

0

根据更正进行编辑:

您需要导入数据库的命名空间,默认情况下将是应用程序命名空间。

<%@ Import namespace = "myappname" %>
于 2013-06-25T14:46:26.933 回答