Frage

I've seen this question asked here before, but never when Enterprise Library is used. I've used code like the following before and it works fine. What's the problem this time? I get the error on the last line:

    Database db = new SqlDatabase(MyConfiguration.Current.ConnectionString);
    DbCommand cmd = db.GetStoredProcCommand("AddWorkListItem");

    db.AddInParameter(cmd, "@PartNumber", DbType.String, partNumber);
    db.AddInParameter(cmd, "@Quantity", DbType.Int32, qty);
    db.AddInParameter(cmd, "@WorkListTypeCode", DbType.String, code);
    db.AddInParameter(cmd, "@UserKey", DbType.Int32, userKey);

    return cmd.ExecuteNonQuery();
War es hilfreich?

Lösung

Gosh it's been a while but I'm pretty sure you call db.ExecuteNonQuery(cmd) rather than cmd.ExecuteNonQuery(). Have you tried that?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top