Ciao ragazzi, spero di non aver postato due volte perchè ieri il sito aveva dei problemi.
Comunque, volevo sapere dove e cosa sbaglio, in allegato vi posto anche il messaggio di eroore
codice:Imports System Imports System.Data.Sql Imports System.Data.SqlClient Dim Cognome, VCognome, CCognome, RCognome As String Dim Nome, VNome, CNome, RNome As String Dim CodiceFiscale As String Dim CodiceLuogo As String Dim ListaComuni As New List(Of String) Dim Anno, Mese, Giorno As String Private Sub cbo_luogo_nascita_TextChanged(sender As Object, e As EventArgs) Handles cbo_luogo_nascita.TextChanged Dim Trovato As Boolean = False Try Using connessione As New SqlConnection() connessione.Open() Dim Query As String = "SELECT * FROM DB_CITTA Where COMUNE = '" & UCase(cbo_luogo_nascita.Text) & "';" Using COMANDO As New SqlCommand(Query, connessione) Using leggi As SqlDataReader = COMANDO.ExecuteReader While leggi.Read txt_cap.Text = leggi.GetString(1) cbo_prov_nascita.Text = leggi.GetString(2) Trovato = True End While If Trovato = False Then txt_cap.Text = "" cbo_luogo_nascita.Text = "" End If End Using End Using End Using Catch ex As Exception MsgBox(ex.Message) End Try CodiceLuogo = txt_cap.Text End Sub
Grazie

Rispondi quotando