Bonjour.
Je trouve pas probleme a mon code. Je dois surement manquer un truc mais je trouve pas.
Dans mon code je dois juste faire un simple select avec une année.
Cela marche bien mais j´ai certaines valeurs NULL dans ma db et impossible d´afficher dans la textbox une valeur.
Comment puis je faire pour contourner ceci ?

J´ai essayer cela :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Imports MySql.Data.MySqlClient
Imports System.DBNull
Imports System.Configuration
Public Class LotesClientesNaves
    Dim MysqlConn As MySqlConnection
    Dim COMMAND As MySqlCommand
    Dim READER As MySqlDataReader
 
    Private Sub LotesClientesNaves_Load(sender As Object, e As EventArgs) Handles MyBase.Load
 
    End Sub
 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim conn As New MySqlConnection(ConfigurationManager.ConnectionStrings("AQUECOUCOU").ToString)
 
 
        conn.Open()
        Dim cmd As New MySqlCommand("Select id,
            Nave,
            Producto,
            Producto_tipo,
            Longitud,
            Anchura,
            Espesor,
            Numero_pale,
            Seleccion,
            Marcado,
            Formato,
            Particularidad,
            Codigo_referencia,
            Fecha,
            Acabado,
            Piezas,
            Kilos
            From Produccion 
            Where YEAR(Fecha)=@year and Nave=@nave and Producto=@producto and Numero_pale=@numeropale", conn)
        cmd.Parameters.AddWithValue("@year", TextBox1.Text)
        cmd.Parameters.AddWithValue("@nave", ComboBox1.Text)
        cmd.Parameters.AddWithValue("@producto", ComboBox2.Text)
        cmd.Parameters.AddWithValue("@numeropale", TextBox2.Text)
 
        Dim myreader As MySqlDataReader = cmd.ExecuteReader
        If (myreader.Read()) Then
            TextBox3.Text = myreader("id")
            TextBox4.Text = myreader("Nave")
            TextBox5.Text = myreader("Producto")
            TextBox6.Text = myreader("Producto_tipo")
            TextBox7.Text = myreader("Longitud")
            TextBox8.Text = myreader("Anchura")
            TextBox9.Text = myreader("Espesor")
            TextBox12.Text = myreader("Numero_pale")
            TextBox10.Text = myreader("Seleccion")
            TextBox13.Text = myreader("Marcado")
            TextBox14.Text = myreader("Formato")
            TextBox15.Text = myreader("Particularidad")
            TextBox16.Text = myreader("Codigo_referencia")
            DateTimePicker1.Text = myreader("Fecha")
            TextBox17.Text = myreader("Acabado")
            TextBox19.Text = myreader("Piezas")
            TextBox11.Text = myreader("Kilos")
        Else
                MessageBox.Show("Error")
        End If
        conn.Close()
 
 
 
    End Sub
Comment faire pour mettre par exemple "N/A" si la valeur est NULL dans la db et le mettre dans la textbox ?
Merci