*Resolved* Web Config Appsettings Connection

Discussion in 'Databases' started by Neil Newman, Mar 8, 2004.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi
    I am testing connection with access db with not much success. In VS IDE everything works but running live the connection does not make eg.

    Web config
    <appSettings>
    <add key ="ConnectionString" value="Provider=Microsoft.jet.oledb.4.0;Data Source=\password.mdb" />
    </appSettings>

    Code Behind
    Public Function ValidateUser(ByVal UID As String, ByVal PWD As String) As Boolean

    Dim OLEConn As New OleDb.OleDbConnection()
    OLEConn.ConnectionString = ConfigurationSettings.AppSettings("connectionstring")
    Dim strSQL As String = "Select Username, password from tblLoginID"
    Dim OLECmd As New OleDb.OleDbCommand(strSQL, OLEConn)
    Dim OLEdr As OleDb.OleDbDataReader
    Try
    OLEConn.Open()
    OLEdr = OLECmd.ExecuteReader()
    Do While OLEdr.Read
    If LCase(OLEdr("Username")).ToString = UID And LCase(OLEdr("password")).ToString = PWD Then
    Return True
    Exit Function
    End If
    Loop
    Catch EX As Exception
    Return False
    End Try
    Return False
    End Function

    Thankyou for time

    Neil

    Resolved i needed the server path of the database directory.
     
  2. Bruce

    Bruce DiscountASP.NET Staff

    You can find the root path to your site in the account information section in the control panel.
    quote:Originally posted by Neil Newman

    Hi
    I am testing connection with access db with not much success. In VS IDE everything works but running live the connection does not make eg.

    Web config
    <appSettings>
    <add key ="ConnectionString" value="Provider=Microsoft.jet.oledb.4.0;Data Source=\password.mdb" />
    </appSettings>

    Code Behind
    Public Function ValidateUser(ByVal UID As String, ByVal PWD As String) As Boolean

    Dim OLEConn As New OleDb.OleDbConnection()
    OLEConn.ConnectionString = ConfigurationSettings.AppSettings("connectionstring")
    Dim strSQL As String = "Select Username, password from tblLoginID"
    Dim OLECmd As New OleDb.OleDbCommand(strSQL, OLEConn)
    Dim OLEdr As OleDb.OleDbDataReader
    Try
    OLEConn.Open()
    OLEdr = OLECmd.ExecuteReader()
    Do While OLEdr.Read
    If LCase(OLEdr("Username")).ToString = UID And LCase(OLEdr("password")).ToString = PWD Then
    Return True
    Exit Function
    End If
    Loop
    Catch EX As Exception
    Return False
    End Try
    Return False
    End Function

    Thankyou for time

    Neil

    Resolved i needed the server path of the database directory.
    </blockquote id="quote"></font id="quote">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page