Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Aug 13, 2012 07:17 PM by tparky
Aug 12, 2012 08:42 PM|LINK
I keep getting the following error with this code, can anyone put me right on what I'm doing wrong or what I'm missing from my code.
Error 1 The best overloaded method match for 'string.Split(params char)' has some invalid arguments C:\Users\Administrator\Documents\Visual Studio 2010\Projects\MailPassword System\MailPassword System\Default.aspx.cs 69 43 MailPassword
Error 2 Argument 1: cannot convert from 'string' to 'char' C:\Users\Administrator\Documents\Visual Studio 2010\Projects\MailPassword System\MailPassword System\Default.aspx.cs 69 60 MailPassword System
string records = System.IO.File.ReadAllLines(Server.MapPath("csv\\import.csv"), System.Text.Encoding.Default);
for (int i = 0; i <= records.Length - 1; i++)
string record = records[i].Split(";");
Response.Write("Succesfully uploaded to sql");
Response.Write("Please input a file");
Any pointer would be nice.
Aug 12, 2012 09:11 PM|LINK
check the value of records[i] before trying to split.
Aug 13, 2012 06:41 AM|LINK
Use single quotes in Split because it takes char not string and double quotes represents string. so it will looks like.
string record = records[i].Split(';');
Aug 13, 2012 07:17 PM|LINK
Thank you for your reply. I new it had to be something simple like that, it was the only thing that I hadn't tried changing.