Import From CSV File

static void ImportFromCSVFile(Args _args)
{
#File
CommaTextIo commaTextIo;
FileIOPermission permission;
container containFromRead;
int x;
int cols;
int rowNum;
int row;

permission = new FileIOPermission(@’C:\DMC.csv’,#io_read);
permission.assert();

commaTextIo = new CommaTextIO(@’C:\DMC.csv’,’R’);
rowNum = 0;

containFromRead = commaTextIo.read();
While(containFromRead)
{
if(rowNum>0) //excluding header of file
{

Cloum1=any2str(conpeek(containFromRead,1));
Colum2=any2str(conpeek(containFromRead,2));

}

containFromRead = commaTextIo.read();
rowNum++;
}
commaTextIo = null;
}

 

Advertisements

One thought on “Import From CSV File

  1. Pingback: Read Csv file from dialog box | dynamics AX Technical Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s