Alla fine ho risolto però ora ho il problema che quando seleziono un Comune con accento o apostrofo la routine va in errore![]()
qualche consiglio ? Grazie
---- CODE -----
Dim ComuneSelezionato As String = cmbComuneResidenza.Text
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0; data source=c:\Dati.mdb;")
Dim cmdCAP As OleDbCommand = New OleDbCommand("Select COMU_CAP FROM Comuni where COMU_DESCR = '" & ComuneSelezionato & "'", con)
Dim cmdPROV As OleDbCommand = New OleDbCommand("Select COMU_PROV FROM Comuni where COMU_DESCR = '" & ComuneSelezionato & "'", con)
Dim cmdCODCOMU As OleDbCommand = New OleDbCommand("Select COMU_COD FROM Comuni where COMU_DESCR = '" & ComuneSelezionato & "'", con)
Dim dr As OleDbDataReader
con.Open()
dr = cmdCAP.ExecuteReader
While dr.Read()
txtCap.Text = dr("COMU_CAP").ToString()
End While
dr = cmdPROV.ExecuteReader
While dr.Read()
txtProv.Text = dr("COMU_PROV").ToString()
End While
dr = cmdCODCOMU.ExecuteReader
While dr.Read()
txtComuCod.Text = dr("COMU_COD").ToString()
End While
dr.Close()
-----------------

Rispondi quotando

