Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to convert this code to .NET
Message
De
28/09/2011 14:25:47
 
 
À
28/09/2011 13:21:39
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01525046
Message ID:
01525090
Vues:
70
>>>Hi friend :
>>> I have the following code in Foxpro and now, could you please show me how to convert it to .NET language ?
>>>
>>>create cursor v_templetA( date d, product_code c(15),product_name c(50))
>>>create cursor v_templetB( date d, product_code c(15),product_name c(50),grpcode c(15),grpname c(50))
>>>
>>>select v_templetA
>>>append from dbf('v_templetB')
>>
>>You should not think in VFP terms when working with .NET
>>The nearest equivalent would be something like:
DataTable v_templateA = new DataTable();
>>            v_templateA.Columns.AddRange( new DataColumn[]{ _
>>                new DataColumn("date",typeof(DateTime)), _
>>                new DataColumn("product_code", typeof(String)), _
>>                new DataColumn("product_name",typeof(String))} _
>>                );
>>            v_templateA.Columns["product_code"].MaxLength = 15;
>>            v_templateA.Columns["product_name"].MaxLength = 50;
>>
>>            DataTable v_templateB = v_templateA.Copy();
>>            DataColumn dc1 = new DataColumn("grpcode",typeof(String));
>>            dc1.MaxLength = 15;
>>            v_templateB.Columns.Add(dc1);
>>            DataColumn dc2 = new DataColumn("grpname", typeof(String));
>>            dc2.MaxLength = 50;
>>            v_templateB.Columns.Add(dc2);
But this is almost certainly not the approach you would take.....
>
>
>Its the append from dbf that is the problem...
>
>I had a small sample prepared with a class, a list of that class and a loop... but decided not to post it.... he needs to understand more about .net inorder to do what he wants....

Duh. I read it backwards (ie. thought the requirement was to copy A to B). But in that case I'd just create B, copy to A and then drop the superfluous columns. But I think you're right - an optimum .NET solution wouldn't look like this at all.....
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform