Your second String.Format
uses {2}
as a placeholder but you're only passing in one argument, so you should use {0}
instead.
Change this:
String.Format("{2}", reader.GetString(0));
To this:
String.Format("{0}", reader.GetString(2));
In this line:
Aboutme.Text = String.Format("{2}", reader.GetString(0));
The token {2} is invalid because you only have one item in the parms. Use this instead:
Aboutme.Text = String.Format("{0}", reader.GetString(0));
Change this line:
Aboutme.Text = String.Format("{0}", reader.GetString(0));
This can also happen when trying to throw an ArgumentException
where you inadvertently call the ArgumentException
constructor overload
public static void Dostuff(Foo bar)
{
// this works
throw new ArgumentException(String.Format("Could not find {0}", bar.SomeStringProperty));
//this gives the error
throw new ArgumentException(String.Format("Could not find {0}"), bar.SomeStringProperty);
}
String.Format must start with zero index "{0}" like this:
Aboutme.Text = String.Format("{0}", reader.GetString(0));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With