Bonjour à tous,
J'essaie d'insérer des données dans une base de données, et j'obtiens l'erreur suivante:
"An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'."
je suis assez débutant dans vb.net et je n'arrive pas à trouver la cause de cette erreur. Pouvez-vous m'aider? voici le code que j'utilise, et le texte en rouge et où le système me signale une erreur:
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 'Déclarer la connexion Dim ObjetConnection As OleDbConnection ' Déclaration l'Objet Commande Dim ObjetCommand As OleDbCommand 'Paramètres de connexion à la DB Dim strConn As String strConn = "Data Source=ECAMLMW091;Initial Catalog=BestEffort_Dev;Persist Security Info=True;User ID=req_priority;Password=********" ObjetConnection = New OleDbConnection 'Donner à la propriété ConnectionString les paramètres de connexion ObjetConnection.ConnectionString = strConn 'Ouvrir la connexion ObjetConnection.Open() 'Instancier un objet Commande ObjetCommand = New OleDbCommand 'Lier Commande et Connexion ObjetCommand.Connection = ObjetConnection 'Indiquer le type de commande ObjetCommand.CommandType = CommandType.Text ObjetCommand.CommandText = "INSERT INTO tbl_Availability (Location, [Date of entry],[Date of Availability],Description,GSDC_Name,PA_Name,MGW_Name) VALUES(DropDownLocation.text, Now, DropDownNextAvailable.text,TextBoxDescription.text,DropdownGSDC.text,DropDownPA.text,DropdownMGW.text)" ObjetCommand.ExecuteNonQuery() 'Fermer la connexion ObjetConnection.Close()
Partager