Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFPOLEDB and Parameters
Message
De
30/06/2004 17:04:41
 
 
À
29/06/2004 20:50:50
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00918644
Message ID:
00919380
Vues:
9
>I'm beginning to realize the same thing...
>
>>Hmm...I could be wrong on this, but I don't think the OLE-DB driver supports parameters (maybe in 9?). I know I messed with this stuff sometime last year and ended up switching over to building the string myself.

Dan,

Sorry I was wrong, this is from the help:
string selectSQL = "SELECT CustomerID, CompanyName FROM Customers WHERE Country = ? AND City = ?";
string insertSQL = "INSERT INTO Customers (CustomerID, CompanyName) " +
                   "VALUES (?, ?)";

string updateSQL = "UPDATE Customers SET CustomerID = ?, CompanyName = ? " +
                   "WHERE CustomerID = ? ";

string deleteSQL = "DELETE FROM Customers WHERE CustomerID = ?";

OleDbConnection nwindConn = new OleDbConnection("Provider=SQLOLEDB;Data Source=localhost;" +
                                                "Integrated Security=SSPI;Initial Catalog=northwind;");
OleDbDataAdapter custDA = new OleDbDataAdapter();

OleDbCommand selectCMD = new OleDbCommand(selectSQL, nwindConn);
custDA.SelectCommand = selectCMD;

// Add parameters and set values.
selectCMD.Parameters.Add("@Country", OleDbType.VarChar, 15).Value = "UK";
selectCMD.Parameters.Add("@City", OleDbType.VarChar, 15).Value = "London";

DataSet custDS = new DataSet();
custDA.Fill(custDS, "Customers");
BOb
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform