Salut a tous,
j'ai un problème, en essayant de se connecté avec la base de données un message d'erreur s'affiche dont le texte est le suivant:
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.SqlClient.dll
Je developpe sur SmartDevice

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
 
System.Data.SqlClient.SqlConnection con;
                        System.Data.SqlClient.SqlCommand cmd;
                        System.Data.SqlClient.SqlDataReader dr;
 
                        try
                        {
                            con = new System.Data.SqlClient.SqlConnection(@"Data Source=C:\Users\Amine\Documents\Visual Studio 2008\Projects\SmartDeviceProject2\SmartDeviceProject2\Produit.sdf");
                            con.Open();
                            cmd = new System.Data.SqlClient.SqlCommand("select * from Prod where (code=' "+tbCode.Text+" ')", con);
                            dr = cmd.ExecuteReader();
                            while (dr.Read())
                            {
                                 multiLineBox.Text = dr.GetString(4);
                            }
                            dr.Close();
                            con.Close();
                        }
 
                        catch (System.Data.SqlClient.SqlException exc1)
                        {
                            Console.WriteLine("SqlException, Erreur numéro " + exc1);
                        }
                        catch (Exception exc)
                        {
                            Console.WriteLine("Exception, Erreur numéro " + exc);
                        }