Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OLE DB VFP tables and Web Forms
Message
De
28/09/2005 10:17:54
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
28/09/2005 09:46:35
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01053693
Message ID:
01053939
Vues:
16
>Cetin,
>
>Thanks for the help. Can I use the code created for the INSERT as a template for the UPDATE and DELETE statements? If not, do you know where there is documentation on how to create those statements manually.

Yes but you don't need to duplicate it exactly. Looks like this:
this.oleDbVFPDataAdapter.UpdateCommand = this.oleDbCommand2;
// 
// oleDbDeleteCommand1
// 
this.oleDbDeleteCommand1.CommandText = "DELETE FROM customer WHERE cust_id = ?";
this.oleDbDeleteCommand1.Connection = this.oleDbVFPConn;
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Cust_id", 
 System.Data.OleDb.OleDbType.VarChar, 6, 
 System.Data.ParameterDirection.Input, false, 
 ((System.Byte)(0)), ((System.Byte)(0)), 
 "Cust_id", System.Data.DataRowVersion.Original, null));
// 
// oleDbInsertCommand1
// 
this.oleDbInsertCommand1.CommandText = 
   "INSERT INTO customer (company, contact, title, address, city, region, postalcode," +
   " country, phone, fax, maxordamt, mylongfieldname, cust_id) VALUES (?, ?, ?, ?, ?" +
   ", ?, ?, ?, ?, ?, ?, ?, ?)";
this.oleDbInsertCommand1.Connection = this.oleDbVFPConn;
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("company", 
  System.Data.OleDb.OleDbType.VarChar, 40, "company"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("contact", 
  System.Data.OleDb.OleDbType.VarChar, 30, "contact"));
// Other...snipped to save space. 
// Key point parameters are defined in order they're in command
this.oleDbInsertCommand1.UpdatedRowSource = System.Data.UpdateRowSource.None;

// 
// oleDbCommand2
// 
this.oleDbCommand2.CommandText = 
  "UPDATE customer SET company = ?, contact = ?, title = ?, address = ?, city = ?, r" +
  "egion = ?, postalcode = ?, country = ?, phone = ?, fax = ?, maxordamt = ?, mylon" +
  "gfieldname = ? WHERE cust_id = ?";
this.oleDbCommand2.Connection = this.oleDbVFPConn;
this.oleDbCommand2.Parameters.Add(new System.Data.OleDb.OleDbParameter("company", 
   System.Data.OleDb.OleDbType.VarChar, 40, "company"));
// Other...snipped to save space. 
// Key point parameters are defined in order they're in command
this.oleDbCommand2.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_cust_id", 
  System.Data.OleDb.OleDbType.VarChar, 6, 
  System.Data.ParameterDirection.Input, false, 
  ((System.Byte)(0)), ((System.Byte)(0)), "cust_id", 
  System.Data.DataRowVersion.Original, null));
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