Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Recognizing memo fields in VFP
Message
De
16/04/2006 18:23:19
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
16/04/2006 14:36:40
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Divers
Thread ID:
01113940
Message ID:
01113959
Vues:
19
>I have a dataset which comes from VFP data. In that data, in VFP, I have character fields and memo fields. However, from the dataset, once a column object is created from the related table, if I use DataType.Name to detect the field type, I obtain String for both fields. I need DataType.Name to be able to recognize that the type when the original source is a memo field. How can I achieve that?

Michel,
AFAIK datacolumn doesnit give you any clue about it (very strange, it is now 2.0 and still a big feature is missing).
OTOH you could use a datareader and get schema table. ie:(in C#)
 OleDbConnection cn = new OleDbConnection("Provider=VFPOLEDB;"+
  @"Data Source=C:\Program Files\Microsoft Visual FoxPro 9\Samples\Data\testdata.dbc");
 cn.Open();
 OleDbCommand cmd = new OleDbCommand("select * from employee", cn);
 OleDbDataReader rdr = cmd.ExecuteReader();
 DataTable dt = rdr.GetSchemaTable();
 cn.Close();

 foreach (DataRow row in dt.Rows)
 {
   Console.WriteLine("Name:{0},Type:{1},Length:{2},Islong:{3}",
      row["ColumnName"],
      row["DataType"],
      row["ColumnSize"],
      row["IsLong"]);
  }
If it's a memo, general or BLOB then ColumnSize is equal to int.MaxValue and IsLong true.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform