SubSonic Forums
All Your Database Are Belong To Us

Getting null reference when trying to run SP

Latest post 11-11-2008 12:21 PM by stieferj. 8 replies.
  • 10-28-2008 12:02 PM

    Getting null reference when trying to run SP

    hey all.

    I have just d/l and installed subsonic. I have a DB all setup with stored procedures. I have generated all the subsonic code and changed my webconfig file.

    Now, when I try to run a SP from my DB, I get the error:

            (NullReferenceException was unhandled by user code)

    The only line I have in my webpage is:

         Dim ds As DataSet = Alpine.SPs.AlpineSpBookingGetCollection().GetDataSet()

    And this SP just basically does a select * from table. There are rows on the table.

    Any ideas why I would get this error? The SP works fine with my normal code..but not with the subsonic stuff Ive only just d/l'd.

    Cheers.

    Filed under:
  • 10-28-2008 4:49 PM In reply to

    Re: Getting null reference when trying to run SP

    Try creating a an instance of the SP first:

     

    Dim sp As SubSonic.StoredProcedure

    sp = Alpine.SPs.AlpineSpBookingGetCollection()

    dim ds as DataSet = sp.GetDataSet()


    ------------------
    Boyan Kostadinov
    Blog: http://blog.tech-cats.com
    Resume: http://boyan.tech-cats.com/resume
    Portfolio: http://boyan.tech-cats.com/portfolio

  • 10-28-2008 5:54 PM In reply to

    Re: Getting null reference when trying to run SP

     ok thanks ill try this when i get to work in the morning...

    the tutorial for it though didnt code like this!

  • 10-29-2008 7:58 AM In reply to

    Re: Getting null reference when trying to run SP

    I still get the same error, when it runs the last line

             "dim ds as dataset = sp.getdataset()"

  • 10-29-2008 8:10 AM In reply to

    Re: Getting null reference when trying to run SP

    I have a few stored procedures in my solutions and dont have problems with them. Without seeing your SP, the standout difference is that my stored procedures all have at least one parameter. I guess it could be a bug that gets found out when you have an SP without parameters, but I would have expected to have seen it reported before now.

     

     

     

  • 10-29-2008 8:36 AM In reply to

    Re: Getting null reference when trying to run SP

     You might want to have a look at this http://www.geekzone.co.nz/JamesHip/5742

     

  • 10-29-2008 10:15 AM In reply to

    Re: Getting null reference when trying to run SP

     invalid link?

  • 10-29-2008 5:12 PM In reply to

    Re: Getting null reference when trying to run SP

    The link works for me,
    Basically, he talks about Subsonic having a bug where it cant instatiate SPs that dont have any parameters and suggests a workaround is to add a dummy parameter.

     

  • 11-11-2008 12:21 PM In reply to

    Re: Getting null reference when trying to run SP

Page 1 of 1 (9 items) | RSS