Click here to Skip to main content
14,926,216 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
im having a trouble here and i can't figure out any solution to this damn issue

what im trying to do is inserting a multiline textbox along with 2 other field everything go right without error except the multiline text it stay blank in the database and i already tried the charcater set= utf8 in the connection string it's driving me nuts please someone help here a sample of my code

requete = "INSERT INTO traces (date_inc,rapport,incident) VALUES (@date,@rapport,@inc)"
sqlCommand = New MySqlCommand(requete, Connexion)
sqlCommand.Parameters.AddWithValue("@date", datestring)
the pb---->sqlCommand.Parameters.AddWithValue("@rapport", Mail.mailtext.Text)
sqlCommand.Parameters.AddWithValue("@inc", ELT.ComboBox4.SelectedIndex)

CHill60 4-Feb-14 16:13pm
How is column rapport defined on your database?
ZiZoU327 5-Feb-14 4:02am
its defined as a text with 3000 character length the probelem is the 2 other field r inserted successfuly but the middle one "rapport" stays blank and i don't know why
Bernhard Hiller 5-Feb-14 2:55am
Is Mail.mailtext.Text the correct variable containing the long text?
I am not sure about the line sqlCommand.CreateParameter() - is it necessary or destructive with MySQL? Never used it with Microsoft SQL Server.
ZiZoU327 5-Feb-14 4:08am
i already delete the line "sqlcommand.createparameter()" and yes "mail" is the name of the form and "mail.text" cntain the text that i want to insert and im using mysql server as database
CHill60 5-Feb-14 4:49am
If you just insert the two columns that are working are you able to use an Update statement to set the value of rapport? You could possibly try changing rapport to a blob? Sorry to be vague - both of these things are ringing bells in my head but I can't find the reference at the moment (or whatever it was that I read)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900