erreur: incorrect integer value '' for column at row 1
Bonjour,
Je fais une appli en c# avec bdd mysql (wampserver)
Dans mon appli, je tente d'ajouter un produit dans une de mes tables via une procédure stockée..
mes tables concernées : product(idProd, designation_Prod, type_Prod) et product_version(#idProd, idVersion)
ma listview comporte 3 colonnes : type / designation / version
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| if (tbxVersion.Text != "")
{
gestLogiciels.PS_Revendeur("Product_insert", tbxTypeProd.Text, tbxDesignation.Text, tbxVersion.Text);
gestLogiciels.PS_Revendeur("Product_Version_insert", tbxTypeProd.Text, tbxDesignation.Text, tbxVersion.Text);
}
if (tbxVersion.Text == "")
{
tbxVersion.Text = "null";
gestLogiciels.PS_Revendeur("Product_insert", tbxTypeProd.Text, tbxDesignation.Text, tbxVersion.Text);
gestLogiciels.PS_Revendeur("Product_Version_insert", tbxTypeProd.Text, tbxDesignation.Text, tbxVersion.Text);
} |
appel de la procédure stockée :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| public void PS_Revendeur(string nomProcedure, string type, string designation, string version)
{
gestion.Connexion();
MySqlCommand cmd = new MySqlCommand(nomProcedure, gestion.conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("type", MySqlDbType.VarChar);
cmd.Parameters.Add("designation", MySqlDbType.VarChar);
cmd.Parameters.Add("version", MySqlDbType.VarChar);
cmd.Parameters["type"].Direction = ParameterDirection.Input;
cmd.Parameters["designation"].Direction = ParameterDirection.Input;
cmd.Parameters["version"].Direction = ParameterDirection.Input;
cmd.Parameters["type"].Value = (type);
cmd.Parameters["designation"].Value = (designation);
cmd.Parameters["version"].Value = (version);
MySqlDataReader dr = cmd.ExecuteReader();
gestion.Deconnexion();
} |
j'ai testé avec une tbxVersion vide, ou remplie avec "testversion" mais il ne me le prend pas et affiche toujours l'erreur :
Code:
MySqlData.MySqlClient.MySqlException : 'Incorrect integer value : 'testversion' for column 'version' at row 1'
je ne comprends pas pourquoi "integer" puisque dans ma table c'est un varchar(100) ...
un peu d'aide me serait très utile :/
Merci d'avance