saving c# sharp string to varchar column
Posted by: Steve Klett
Date: August 30, 2006 01:06PM

I posted this over in the newbie forum, but it might be better here as it's specific to the .net connector
http://forums.mysql.com/read.php?10,113013,113013#msg-113013

I'm getting an error:
"#22001Data too long for column '_protocolOrdering' at row 1"

I'm using MySql 5.0.22 On Windows Server 2003.

The column is a VARCHAR(200) (you can see the full table sql below)

The data I'am trying to save is:
"4;2;5;3;6;7;8;9;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24"

I have tried different delimiters in case that was the problem, it didn't help.


Here is the full table sql:
CREATE TABLE `tbl_fe_customerconfigs` (
`ConfigurationID` int(10) NOT NULL auto_increment,
`CustomerID` int(10) NOT NULL default '0',
`ConfigName` varchar(50) NOT NULL default '',
`Description` longtext,
`IsDemo` tinyint(1) default NULL,
`AmpRangeMax` double(7,2) NOT NULL default '0.00',
`QuartetLCDTopLine` varchar(50) NOT NULL default '',
`QuartetLCDBottomLine` varchar(50) NOT NULL default '',
`DuetPlusLCDTopLine` varchar(50) NOT NULL default '',
`DuetPlusLCDBottomLine` varchar(50) NOT NULL default '',
`DuetLCDTopLine` varchar(50) NOT NULL default '',
`DuetLCDBottomLine` varchar(50) NOT NULL default '',
`LCDScrollSpeed` smallint(5) NOT NULL default '0',
`LCDScrollInitHold` smallint(5) NOT NULL default '0',
`LCDLoopCount` smallint(5) NOT NULL default '0',
`BaseFrequency` smallint(5) NOT NULL default '0',
`DateCreated` datetime NOT NULL default '0000-00-00 00:00:00',
`DateModified` datetime NOT NULL default '0000-00-00 00:00:00',
`ProtocolOrdering` varchar(200) default NULL,
`FirmwareID` smallint(6) default NULL,
`FirmwareMinorVersion` tinyint(4) unsigned NOT NULL default '0',
PRIMARY KEY (`ConfigurationID`),
UNIQUE KEY `ConfigID` (`ConfigurationID`),
KEY `CustomerID` (`CustomerID`),
KEY `Tbl_CustomersTbl_CustomerConfigs` (`CustomerID`),
KEY `FK_tbl_fe_customerconfigs_FirmwareID` (`FirmwareID`),
CONSTRAINT `FK_tbl_fe_customerconfigs_CustomerID` FOREIGN KEY (`CustomerID`) REFERENCES `tbl_customers` (`CustomerID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_tbl_fe_customerconfigs_FirmwareID` FOREIGN KEY (`FirmwareID`) REFERENCES `tbl_firmware` (`ID`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1


I don't see the problem and a search for this error turns up TONS of different problems and solutions, after several failed attempts to resolve the issue I stopped and thought I should ask here in case someone sees the problem right away.

(more info)
More information, but still no solution.

Using query browser I can insert this string into the row:
"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"


From my .net app trying to do the same thing with a parameter like this:
param = new MySqlParameter("?_protocolOrdering", string.Empty);
param.Value = "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";
command.Parameters.Add(param);


throws an exception with error 22001 as the reason.

I've tried different character sets, I've changed the column to a CHAR(220) default charset.

The max character I can add via the .Net connector is 50.

Completely stuck, anyone have any ideas?

Options: ReplyQuote


Subject
Written By
Posted
saving c# sharp string to varchar column
August 30, 2006 01:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.