我无法使用外部连接文件
连接到SQL数据库我收到类似namespace or type specified in the imports 'Pirelli.dbPirelli' does not contain any public member
知道我怎么能这样做吗?
谢谢!
Default.aspx.vb
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Common.DbDataReader
Imports System.Web.UI
Imports System.IO
Imports Pirelli.dbPirelli
Partial Class _Default
Inherits System.Web.UI.Page
Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs)
Dim cmd As New SqlCommand
Dim SQLdr As SqlDataReader 'The Local Data Store
cmd.Connection = dbConnectDBOStr
End Sub
dbPirelli.vb - 数据库连接文件:
Imports System.Data.SqlClient
Namespace Pirelli
Public Class dbPirelli
Public Const strServerName As String = "testserver" 'DEV
Public Const dbConnectDBOStr As String = "uid=[MYIDHERE];password=[MYPASSHERE];database=[DBNAMEHERE];server=" & strServerName & ";Connection Timeout=60;"
End Class
End Namespace
答案 0 :(得分:0)
您需要以这种方式引用它
Imports YourProjectName.Pirelli.dbPirelli