Bonjour à tous !
Je cherche à faire un simple insert et après moult recherche, je ne trouve pas la solution du problème que voilà :
J'obtiens "OleDbCommand.Prepare method requires all variable length parameters to have an explicitly set non-zero Size." à la ligne "myCommand.Prepare();"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 string connectionString = "provider=MSDAORA;data source=DEV;user id=data;password=data"; OleDbConnection myConnection = new OleDbConnection(connectionString); OleDbCommand myCommand = myConnection.CreateCommand(); myConnection.Open(); myCommand.CommandText = "insert into environ (nomEnviron, rangEnviron) values (@nom, @rang)"; myCommand.Parameters.Add("@nom", OleDbType.VarChar).Value = nom; myCommand.Parameters.Add("@rang", OleDbType.Integer).Value = rang; myCommand.Prepare(); myCommand.ExecuteNonQuery(); myConnection.Close();
Merci de votre aide !
Partager