Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi....
I want to display .dat file into datagrid in column format ..please explain though code...

below is my .dat file format

VB
5    ,000022,004050          ,000004,19.09.14,12341234
  4021,000100,SONU GANPAT YADA,1550  ,19.09.14,000100
  4068,000500,SANDIP BABAN AKH,9050  ,19.09.14,000500
  4119,001000,JEEVAN KAMALAKAR,41080 ,19.09.14,001000
  4139,000050,INDUBAI RAMCHAND,1400  ,19.09.14,000050
  4144,000100,SUREKHA SANJAY P,2900  ,19.09.14,000100
  4650,000100,YASHWANT GOVINDR,5300  ,19.09.14,000100
  4654,000050,SACHIN BALKRISHN,750   ,19.09.14,000050
  4656,000100,SITARAM LAXMAN G,3500  ,19.09.14,000100
  4659,000100,MAHESHKUMAR SHAR,2000  ,19.09.14,000100
  4623,001000,MEENA KISHOR KAM,43000 ,19.09.14,001000
  4626,000200,HUSSAIN . HASHAM,8000  ,19.09.14,000200
  4629,000200,SHABANA KAUSAR N,14800 ,19.09.14,000200
  4630,000100,GANESH K SUKALE ,3000  ,19.09.14,000100
  4632,000050,RAVINDRA LAXMAN ,3250  ,19.09.14,000050
  4633,000050,SAHIL HARISH YEO,3250  ,19.09.14,000050
  4634,000025,SAVITA ANIL YEOL,1700  ,19.09.14,000025
  4635,000025,ANIL LAXMAN YEWL,1700  ,19.09.14,000025
  4639,000050,NISHA SURESH NAI,2100  ,19.09.14,000050
  4640,000050,KUNAL SURESH NAI,2100  ,19.09.14,000050
  4641,000050,SANIKA SURESH NA,2100  ,19.09.14,000050
  4643,000100,SANJAY UTRESHWAR,6100  ,19.09.14,000100
  4644,000050,MANGALA LAXMAN K,3200  ,19.09.14,000050

Posted
Updated 9-Oct-14 1:40am
v2
Comments
suraj Repe 9-Oct-14 3:33am    
hi...
I want sample code for "how to import .dat file into datagrid using c#"
please help me...its urgent
thanks...

1 solution

You need to use ADO.NET[^] - OleDb[^].

The way is the same as is described here: Accessing Microsoft Office Data from .NET Applications[^]. The only difference is that that you need treat (in this case) *.dat file as a text file.
To get proper result, sometimes it needed to create schema.ini file[^], which contains information about general format of the file, like: the column name and data type information, and several other data characteristics.

See my past answers[^] too to find sample code.

Try!
 
Share this answer
 
v3
Comments
suraj Repe 9-Oct-14 3:05am    
hello sir ,
Can you give me code for this
Maciej Los 9-Oct-14 6:07am    
Please follow the link provided in sentence: "See my past anwers too to find sample code."

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900