views:

102

answers:

2

This issue is driving me mad.

I have several tables defined, and CRUD stored procs for those tables. I have wired up the stored procs to the tables in Visual Studio using the dbml mapper.

All work fine, except for one table. The insert stored proc is not being hit for my history table.

The insert property in the table in the dbml mapper is:

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 attempting to hit 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 the profiler, I can see the stored proc is not being hit. I renamed the stored proc in the database (in an attempt to generate an exception), just to double check.

If I try to manually hit the stored proc (as follows), it works fine!

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

Has anyone come across this issue before?

FIXED! see answer below. Can someone please close this?

A: 

Did you manually wired up your sproc to your table in the .dbml file? If you select a table a in the property grid you may see an Insert behavior. If it says, Use Runtime, then you SPROC will not be called and you have change that setting from Use Runtime, to manually configure it to call you SPROC on Insert.

tdavisjr
It doesn't say use runtime, next to Insert it has the stored proc call. :(
deadcat
+2  A: 

Ok, this is unbelievable but... the app already had a page called history.aspx. VB defaulted to the history class for that page, rather than the db.History class used by LinQ.

Once I renamed history.aspx, everything worked! :)

deadcat