locked
Difference between AddInParameter and SqlParameter RRS feed

  • Question

  • User1982844092 posted

    In this article, it talks about the common SqlParameter.  I want to use DAAB to do an insert and was trying to do it this way...but didn't know how to set the value to the input parameters for my stored procedure:

    Database db = DatabaseFactory.CreateDatabase();

    DbCommand dbCommandWrapper = db.GetStoredProcCommand("Search_KeywordSearchLog_I");

    db.AddInParameter(dbCommandWrapper, "SearchTerm", System.Data.DbType.String, 40);<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    db.AddInParameter(dbCommandWrapper, "CreateDate", System.Data.DbType.DateTime, DateTime.Now);<o:p></o:p>

    db.AddInParameter(dbCommandWrapper, "ResultCount", System.Data.DbType.Int16, 1);

     

    db.ExecuteNonQuery(dbCommandWrapper);

    I think the above is only for if you want to call a stored proc to get information, not do an insert right?  I didn't see a way to set the value for the parameter such as a textbox value to pass to the stored proc so I assume use some other method in the DAAB 2.0?

    Tuesday, July 25, 2006 3:22 PM

All replies

  • User-1355649840 posted
    Looking at your example, and without seeing the stored proc, I would say that you need to pass in the textbox value for SearchTerm. Also, I don't think ResultCount should be an "in" parameter...
    Wednesday, July 26, 2006 1:01 PM
  • User1982844092 posted

    I'v actually figured this out already on my own, thanks though.  I already had a textbox and all that.  Resultcount is my own param, one of the fields in my DB table.  Anyway, I'm closing this.

    Wednesday, July 26, 2006 1:21 PM
  • User1189380964 posted
    Can any one help me in providing a link to a page where we can see the syntax of AddInParameter, and AddOutParameter. Please.
    Thursday, March 22, 2007 11:35 AM