Bytefx <> MySQL Convertion Problems
Hey all,
The program I wrote in VB.NET was initially based on the bytefx connector.
It worked perfectly, except one thing. This bug which I had was fixed in the new release (MySQL Connector/Net).
After converting my program to the new connector it gives new problems (the old problem is indeed solved) but this one is worse.
In VS it gives during debugging the message: "Index and length must refer to a location within the string.
Parameter name: length"
There is no parameter with the name lenght, so I think the error is kinda weird. I solved this problem earlier to change the dbtype for a column. But in this situation the dbtype is text, and the length is 0 (exact as the database). The problem is that the new connector does not support (?) the text dbtype (with 0 as length).
Can anyone help me out ?
The problem is occuring during the following code:
Dim sqlstr As New MySql.Data.MySqlClient.MySqlCommand("INSERT INTO tbl_helpdesk_berichten (berichtid,cdrelatie,callid,berichtzvk,afzendertype,afzendernummer,berichttxt,datum,tijd,status) VALUES (?p_berichtid,?p_cdrelatie,?p_callid,?p_berichtzvk,?p_afzendertype,?p_afzendernummer,?p_berichttxt,?p_datum,?p_tijd,?p_status)", modShared.dbcon)
sqlstr.Parameters.Add("?p_berichtid", MySql.Data.MySqlClient.MySqlDbType.Int16, 6, "?p_berichtid").Value = intNwBerichtid
sqlstr.Parameters.Add("?p_cdrelatie", MySql.Data.MySqlClient.MySqlDbType.Int16, 6, "?p_cdrelatie").Value = intKlantnrOverall
sqlstr.Parameters.Add("?p_callid", MySql.Data.MySqlClient.MySqlDbType.Int16, 6, "?p_callid").Value = intCallnrOverall
sqlstr.Parameters.Add("?p_berichtzvk", MySql.Data.MySqlClient.MySqlDbType.Int16, 1, "?p_berichtzvk").Value = intZvK
sqlstr.Parameters.Add("?p_afzendertype", MySql.Data.MySqlClient.MySqlDbType.Int16, 1, "?p_afzendertype").Value = 2
sqlstr.Parameters.Add("?p_afzendernummer", MySql.Data.MySqlClient.MySqlDbType.VarChar, 255, "?p_afzendernummer").Value = modLogin.intMedewerker
sqlstr.Parameters.Add("?p_berichttxt", MySql.Data.MySqlClient.MySqlDbType.VarChar, 0, "?p_berichttxt").Value = strBerichttxt
sqlstr.Parameters.Add("?p_datum", MySql.Data.MySqlClient.MySqlDbType.VarChar, 10, "?p_datum").Value = strDatum
sqlstr.Parameters.Add("?p_tijd", MySql.Data.MySqlClient.MySqlDbType.VarChar, 5, "?p_tijd").Value = strTijd
sqlstr.Parameters.Add("?p_status", MySql.Data.MySqlClient.MySqlDbType.Int16, 1, "?p_status").Value = intNwStatus
sqlstr.Connection.Open()
sqlstr.ExecuteNonQuery()
sqlstr.Connection.Close()
The database design is as follows:
::columnname:: ::dbtype:: ::length::
berichtid - int - 6
cdrelatie - int - 6
callid - int - 6
berichtzvk - tinyint - 1
afzendertype - tinyint - 1
afzendernummer - varchar - 255
berichttxt - text - 0
datum - varchar - 10
tijd - tijd - 5
status - tinyint - 1