Stored Proc fails with LINQ

This problem is driving me crazy.

I have multiple tables defined and CRUD stores procs for those tables. I have connected stored procs to tables in Visual Studio using dbml mapper.

Everything works fine except for one table. The nested stored procedure doesn't end up in my history table.

Insert property on table in dbml mapper:

usp_HistoryInsert (ByRef historyID As System.Int32, changeRequestID As System.Int32, statusID As System.Int32, userID As System.Int32, emailSent As System.Boolean, historyDate As System.DateTime, remarks As System.String, statusChanged As System.Boolean)

      

I am trying to push it with the following code:

    ' create new history entry
    h1.ChangeRequestID = ChangeID
    h1.UserID = Session("UserID")
    h1.HistoryDate = DateTime.Now
    h1.StatusChanged = ActionID
    h1.Remarks = RichTextEditor1.Text
    h1.EmailSent = True
    h1.StatusID = ActionID

    db.Histories.InsertOnSubmit(h1)
    db.SubmitChanges()

      

Using a profiler, I can see that the stored process is not being hit. I renamed the stored proc in the database (in an attempt to throw an exception), just to double check.

If I try to manually hit the saved proc (as mentioned below) it works great!

db.usp_HistoryInsert(0, h1.ChangeRequestID, h1.StatusID, h1.UserID, h1.EmailSent, h1.HistoryDate, h1.Remarks, h1.StatusChanged)

      

Has anyone encountered this problem before?

FIXED! see answer below. Can anyone close this?

+1


source to share


2 answers


Ok, this is incredible, but ... the app already had a page named history.aspx. The default VB for the history class for this page, not the db.History class used by LinQ.



As soon as I renamed history.aspx everything worked! :)

+2


source


Have you manually connected your sproc to your table in the .dbml file? If you select table a in the properties grid, you will see Insert behavior. If it says "Use Runtime" then SPROC will not be called and you will change this setting from "Use Runtime" to manually configure it to call SPROC on Insert.



0


source







All Articles