mardi 4 août 2015

How to get the data of the query after the insertion of parameters?

How can I get a String with the SQL query, once parameters inserted in C# with oledb ?

Here is my code:

var c = new OleDbConnection(@"blahba");

c.Open();

var q = new OleDbCommand(@"
    SELECT *
    FROM @table
    WHERE created = @creation
", c);

q.Parameters.AddRange(new[]{
    new OleDbParameter{
        ParameterName = "@creation",
        Value = "2007-05-13",
        OleDbType = OleDbType.Date,
    },
    new OleDbParameter{
        ParameterName = "@table",
        Value = "table",
        OleDbType = OleDbType.IUnknown,
    }
});

// ... ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire