none
Error: StartIndex cannot be less than zero. Parameter name: startIndex while opening a connection RRS feed

  • Question

  • I am testing that my provider is supporting IPv6 address or not.
    In my application, simply I created a connection by passing the DataSource, UserID and password. I tried to open the connection then I am getting the error

    "StartIndex cannot be less than zero.
    Parameter name: startIndex
    System.ArgumentOutOfRangeException: StartIndex cannot be less than zero.
    Parameter name: startIndex"

    I mentioned the IPv4 address of the database in the host file and used the database name in the connection string, then the application worked fine. When I have mentioned the IPv6 address in the host file for the database, then I am getting the above error. 

    As I have no idea, why the above error is coming when I am trying to open a connection with the IPv6 address.
    Please help me on this issue.

    Here is My Code:

    static void Main(string[] args)
            {
                //using (Connection cn = new Connection("Data Source=2001:db8:1234:5678:20c:29ff:fe94:d194;user id=netdp; password=netdp;"))
                using (Connection cn = new Connection("Data Source=database1;userid=netdp; password=netdp;"))
                {
                    try
                    {
                        Console.WriteLine(cn.ConnectionString);
                        cn.Open();
                        Console.WriteLine(cn.ConnectionString);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e.Message);
                        Console.WriteLine(e.ToString());
                    }
            }
    Tuesday, July 7, 2009 6:07 AM

All replies