Ciao a tutti, sono nuovo del forum e volevo salutare tutti.
Volevo anche porvi una domanda un po' strana.
Io lavoro con Win10 e ho installato VB Community 2019.
Sto lavorando con database ADO e ho fatto la seguente query indentata:
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim dbComm As OleDbCommand = dbConn.CreateCommand
        Dim dbCom1 As OleDbCommand = dbConn.CreateCommand
        Dim r As OleDbDataReader
        Dim sSql As String
        Dim iSett As Integer
        Dim iGior As Integer
        iGior = DateTime.Now.DayOfWeek
        iSett = iNumeroSettimana(Now.ToShortDateString) Mod 4
        iSett = iSett + 1
        sSql = "SELECT descrizione "
        If Month(DateTime.Now.ToShortDateString) < 7 Or Month(DateTime.Now.ToShortDateString) > 9 Then
            sSql = sSql & "FROM mansionario1 "
        Else
            sSql = sSql & "FROM mansionario2 "
        End If
        sSql = sSql & "WHERE settimana = " & iSett & " AND giorno = " & iGior
        sSql = sSql & " ORDER BY id_ordine"
        dbConn.Open()
        dbComm.CommandType = CommandType.Text
        dbComm.CommandText = sSql
        r = dbComm.ExecuteReader
        dbCom1.CommandType = CommandType.Text
        dbCom1.CommandText = "INSERT INTO scadenze (titolo, descrizione, data_ins, data_scad, data_esec, annotazione, priorita) VALUES (?, ?, ?, ?, ?, ?, ?)"
        While r.Read
            dbCom1.Parameters.Add("@titolo", OleDbType.Char, 255).Value = r(0)
            dbCom1.Parameters.Add("@descrizione", OleDbType.Char, 255).Value = ""
            dbCom1.Parameters.Add("@data_ins", OleDbType.Date).Value = FirstData
            dbCom1.Parameters.Add("@data_scad", OleDbType.Date).Value = LastData
            dbCom1.Parameters.Add("@data_esec", OleDbType.Date).Value = "31/12/1999"
            dbCom1.Parameters.Add("@annotazione", OleDbType.Char, 255).Value = ""
            dbCom1.Parameters.Add("@priorita", OleDbType.Numeric).Value = 3
            dbCom1.ExecuteNonQuery()
        End While
        r.Close()
        dbConn.Close()
Il problema che ho si rivela condbCom1.Parameters.Add("@titolo", OleDbType.Char, 255).Value = r(0) perchè i valori che mette nelle diverse righe sono sempre gli stesso (facendo però l'inserimento nella tabella di un numero corretto di record).
Ho provato a inserire una msgbox(r(0)) e mi restituisce valori corretti alla msgbox ma nella query INSERT no!
Non so veramente cosa fare.
Grazie di cuore a tutti e buona programmazione.