Index was outside the bounds of the array exception
问题 Here is my code to get data from a flat file and insert into SQL Server. It is generating an exception ( Index was outside the bounds of the array ). string path = string.Concat(Server.MapPath("~/TempFiles/"), Fileupload1.FileName); string text = System.IO.File.ReadAllText(path); string[] lines = text.Split(' '); con.Open(); SqlCommand cmd = new SqlCommand(); string[] Values = new string[3]; foreach (string line1 in lines) { Values = line1.Split(';'); string query = "INSERT INTO demooo VALUES