Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Dove sbaglio?

  1. #1
    Utente di HTML.it L'avatar di Enzodm
    Registrato dal
    Nov 2008
    Messaggi
    15

    Dove sbaglio?

    Private Sub Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click

    Dim ConnectionString As String = "MYConnessione"
    Dim ProviderName As String = "System.Data.SqlClient"
    Dim Query As String

    Query = "SELECT NOME_UTENTE, PASSWORD WHERE NOME_UTENTE=" & MYNOME.Text & MYPASSWORD.Text & "FROM UTENTI"

    Dim Connect As New OleDb.OleDbConnection(ConnectionString)
    Dim Cmd As New OleDb.OleDbCommand(Query, Connect)
    Dim Reader As OleDb.OleDbDataReader

    Try
    Connect.Open()
    Reader = Cmd.ExecuteReader
    If Reader.Read() Then
    ' Controllo necessario per il case sensitive
    If MYNOME.Text Is Reader("NOME_UTENTE") And MYPASSWORD.Text Is Reader("PASSWORD") Then
    ' Aggiungo l'utente alla sessione ed effettuo il redirect alla Home
    Session.Add("NOME_UTENTE", MYNOME.Text)
    Response.Redirect("Profilo.aspx")
    Else
    ' Username o Password errate
    End If
    Else
    ' Username o Password errate
    End If
    Catch ex As Exception
    ' Errore
    Finally
    ' Se la connessione è rimasta aperta, la chiudo
    If Not Connect Is Nothing Then
    Connect.Close()
    End If
    End Try
    End Sub



    Ho questo errore alla linea 23:

    Server Error in '/' Application.
    An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.

    Source Error:

    Line 21: Query = "SELECT NOME_UTENTE, PASSWORD WHERE NOME_UTENTE=" & MYNOME.Text & MYPASSWORD.Text & "FROM UTENTI"
    Line 22:
    Line 23: Dim Connect As New OleDb.OleDbConnection(ConnectionString)
    Line 24: Dim Cmd As New OleDb.OleDbCommand(Query, Connect)
    Line 25: Dim Reader As OleDb.OleDbDataReader

  2. #2
    Utente di HTML.it L'avatar di Enzodm
    Registrato dal
    Nov 2008
    Messaggi
    15

    Dove sbaglio?

    Ciao Luigi, la connessione al database è giusta, fa + o meno così:
    Data Source=xxx.xx.xxx.xx;Network Library=;database=MSSqlxxxxx;Connection Timeout=0;Packet Size=4096;Integrated Security=no;User ID=MSSqlxxxxx;Encrypt=no;pwd=xxxxxxxxxxx;"


    Il problema è alla linea 23 del post precedente. Mi restituisce questo errore:

    Server Error in '/' Application.
    An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Ma la dichiarazione del provider la passo con:

    Dim Providers As String = "System.Data.SqlClient"

    Non funziona...

  3. #3
    Utente di HTML.it L'avatar di Enzodm
    Registrato dal
    Nov 2008
    Messaggi
    15

    Dove sbaglio?

    Si, lavoro con Visual Studio. Sto generando un'applicazione web con VWD 2005 con database MYSQL Server... Pubblicherò il link al sito appena finisco! Provo a fare come mi hai detto. A presto!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.