MySql error - Index and length must refer to a location within the string

132 Views Asked by At

When I try xml_command.ExecuteNonQuery(); I get this error -

System.ArgumentOutOfRangeException: Index and length must refer to a location within the string.

Parameter name: length

The sql_string is this :

"insert into main (ID, YearDate, MeterID1, LocationID1, MeterID2, LocationID2, MeterID3, LocationID3, MeterID4, LocationID4, MeterID5, LocationID5, MeterID6,
LocationID6, MeterID7, LocationID7, MeterID8, LocationID8 ,MeterID9, LocationID9, 
MeterID10, LocationID10, MyDate, MyGroup, BIN1, BIN2, BIN3, BIN4, BIN5, BIN6, BIN7, BIN8, BIN9, BIN10) 

values ('73', '2019', '1', '2', '3', '4', '5', '6', '7', '8', '9', '41', 'default', 'default', 'default', 'default', 'default', 'default', 'default', 'default', 'default', 'default', '2019-12-04', '1', '@File1, @File2, @File3, @File4, @File5, null, null, null, null, null);"

I know what the error means, but cant find solution.

0

There are 0 best solutions below