I have a .txt file that is setup like this:
1 Username Email MD5Password PlainPassword
Now I want to put this .txt into SQL, so I have this code:
string[] SQL = line.Split(' ');
dynamic ID = SQL[0];
dynamic Username = SQL[1];
dynamic Email = SQL[2];
dynamic Password = SQL[3];
dynamic PlainPassword = SQL[4];
string lines = "INSERT INTO `dbsearch`(`username`, `password`, `email`, `extra`) VALUES ('" + Username + "', '" + Password + "', '" + Email + "', '" + PlainPassword + "')";
But some lines in my .txt file doesnt have a password or plainpassword, so I get this error:
Exception thrown: 'System.IndexOutOfRangeException' in Search SQL Creator.exe
Additional information: Index was outside the bounds of the array.
How can I fix this?
SQL, and if it contains 5 values do as now, and if only 3 set default values for P and PP.dynamicwhen the values are clearlystring?