Visualizzazione dei risultati da 1 a 1 su 1

Visualizzazione discussione

  1. #1

    [VB.NET]: Problemi di connessione al db.accdb

    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
    Immagini allegate Immagini allegate

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.