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
Was it helpful?

Solution

You need to reference it in this way

Imports YourProjectName.Pirelli.dbPirelli
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top