I'm having a old Visual FoxPro programm, which i need to rewrite in c#. There we used the cursors from VFP, to read .txt-files and load it into temporary cursors.
Looks for example like this in FoxPro: (mb5b is the mb5b-textfile)
SELECT werk,matnr,ALLTRIM(matnr)+ALLTRIM(werk) as matwerk,sum(zugang) as zugang,sum(abgang) as abgang INTO CURSOR mb5b_temp FROM mb5b GROUP BY werk,matnr
Those cursors dont exist in c#. (I didnt found anything like this.) So im creating a DataTable and while reading the file I insert it into the DataTable.
DataTable dt_mb5b_temp = new DataTable();
dt_mb5b_temp.Columns.Add("matnr");
dt_mb5b_temp.Columns.Add("werk");
dt_mb5b_temp.Columns.Add("matwerk");
dt_mb5b_temp.Columns.Add("zugang");
dt_mb5b_temp.Columns.Add("abgang");
while ((mb5bline = sr_mb5b.ReadLine()) != null)
{
DataRow dr = dt_mb5b_temp.NewRow();
string[] mb5b = mb5bline.Split(new Char[] { '|' });
dr["matnr"] = mb5b[1].Trim();
dr["werk"] = mb5b[2].Trim();
dr["matwerk"] = mb5b[1].Trim() + mb5b[2].Trim();
dr["zugang"] = mb5b[6].Trim();
dr["abgang"] = mb5b[7].Trim();
}
I thought i may can work with the DataTable.Select() to use a select-statment as above, but it doesnt work ... And other solutions dont come to my mind at the moment :/
For sure i could also insert it into a DB - then use select, but i try to avoid this (Would need two extra tables, and i think those inserts and select will take a long time). Is there any possibility to get this working ?
Thanks!
If you need anymore Informations, please tell.