You need to reference it in this way
Imports YourProjectName.Pirelli.dbPirelli
Question
I can't manage to connect to an SQL database using an external connection file
I am getting an error which is something like namespace or type specified in the imports 'Pirelli.dbPirelli' does not contain any public member
Any idea how I can do this??
Thanks!!
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 - database connection file:
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
Solution
You need to reference it in this way
Imports YourProjectName.Pirelli.dbPirelli