Not sure why you are getting that error. But maybe you need to test for the length first. If it's >100 use the SubString overload that takes start and length, otherwise, just use the overload that takes the start alone.
Also, unless you have another reason for replacing the ' in your string, you don't need to replace them when you are using a command parameter. The parameter object will take care of escaping the characters that need it.
-
Peter