Click here to Skip to main content
15,902,862 members
Home / Discussions / C#
   

C#

 
AnswerRe: Windows service using C# Pin
#realJSOP17-Sep-08 4:39
professional#realJSOP17-Sep-08 4:39 
GeneralRe: Windows service using C# Pin
Mohammed Hameed18-Sep-08 23:58
professionalMohammed Hameed18-Sep-08 23:58 
AnswerRe: Windows service using C# Pin
PIEBALDconsult17-Sep-08 6:37
mvePIEBALDconsult17-Sep-08 6:37 
GeneralRe: Windows service using C# Pin
Mohammed Hameed18-Sep-08 23:59
professionalMohammed Hameed18-Sep-08 23:59 
GeneralRe: Windows service using C# Pin
PIEBALDconsult19-Sep-08 5:20
mvePIEBALDconsult19-Sep-08 5:20 
QuestionExport single Pages from a .indd file Pin
frostii17-Sep-08 0:50
frostii17-Sep-08 0:50 
Questionevent id for system reboot Pin
George_George17-Sep-08 0:44
George_George17-Sep-08 0:44 
QuestionReading csv file into a dataTable Pin
Muammar©17-Sep-08 0:38
Muammar©17-Sep-08 0:38 
DataTable dt = new DataTable();
StreamReader sr = new StreamReader("C:\\FileName.csv");

DataColumn[] cols = new DataColumn[sr.ReadLine().Split(',').Length];
dt.Columns.AddRange(cols);

while(!sr.EndOfStream)
    dt.Rows.Add(sr.ReadLine().Split(','));// ---> <font color="#ee0000">Error: Input array is longer than the number of columns in this table.</font>

datagrid1.DataSource = dt;


What's so wrong with that?? Any better practice??

Thanks!


All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)

AnswerRe: Reading csv file into a dataTable Pin
Ashfield17-Sep-08 1:18
Ashfield17-Sep-08 1:18 
GeneralRe: Reading csv file into a dataTable Pin
Muammar©17-Sep-08 1:25
Muammar©17-Sep-08 1:25 
GeneralRe: Reading csv file into a dataTable Pin
Ashfield17-Sep-08 2:11
Ashfield17-Sep-08 2:11 
AnswerRe: Reading csv file into a dataTable Pin
Colin Angus Mackay17-Sep-08 2:16
Colin Angus Mackay17-Sep-08 2:16 
GeneralRe: Reading csv file into a dataTable Pin
Muammar©17-Sep-08 4:53
Muammar©17-Sep-08 4:53 
GeneralRe: Reading csv file into a dataTable Pin
PIEBALDconsult17-Sep-08 5:22
mvePIEBALDconsult17-Sep-08 5:22 
GeneralRe: Reading csv file into a dataTable Pin
Muammar©17-Sep-08 13:37
Muammar©17-Sep-08 13:37 
GeneralRe: Reading csv file into a dataTable Pin
PIEBALDconsult17-Sep-08 16:44
mvePIEBALDconsult17-Sep-08 16:44 
QuestionGet a value ID from a ListBox,which is bind to a Data source. Pin
CJGun16-Sep-08 23:06
CJGun16-Sep-08 23:06 
AnswerRe: Get a value ID from a ListBox,which is bind to a Data source. Pin
CJGun17-Sep-08 19:15
CJGun17-Sep-08 19:15 
Questioncsv imports Pin
rahuladya16-Sep-08 23:05
rahuladya16-Sep-08 23:05 
AnswerRe: csv imports Pin
Giorgi Dalakishvili16-Sep-08 23:14
mentorGiorgi Dalakishvili16-Sep-08 23:14 
GeneralRe: csv imports Pin
Alan Balkany17-Sep-08 4:15
Alan Balkany17-Sep-08 4:15 
GeneralRe: csv imports Pin
Giorgi Dalakishvili17-Sep-08 4:21
mentorGiorgi Dalakishvili17-Sep-08 4:21 
AnswerRe: csv imports Pin
Mohammed Hameed17-Sep-08 1:00
professionalMohammed Hameed17-Sep-08 1:00 
GeneralRe: csv imports Pin
Ashfield17-Sep-08 1:22
Ashfield17-Sep-08 1:22 
Questionset Icon in the Add/Remove program Pin
lune1216-Sep-08 21:50
lune1216-Sep-08 21:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.