Thursday, July 12, 2012

Using SqlDependency without providing an options value Error

Using SqlDependency without providing an options value Error.
When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance.
Using SqlDependency without providing an options value Exception.

SqlDependency is awesome.  It truly is.  Problem is it has a lot of unexpected behaviors to an SqlDependency noob. 

I got this error: "When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance" couple of hours ago and I decided to share.

This error occurs if you didn't started your SqlDependency or it got closed for some reason.  I usually start it this way in the Global.asax:
    
 protected void Application_Start(Object sender, EventArgs e)
 {
   var sConn = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
   SqlDependency.Start(sConn);
 
   // Cache systemwide data in the application object.
   ApplicationAdapter.InitApplicationCache();
 }

You must pay attention to errors though.  Since it might fall while running, always have a check on the exception type at the Application_Error, so you'll know to restart the SqlDependency in case it stops.

Hope it helped,
Elad Shalom,
CTO at ITweetLive.com

14 comments:

  1. Hey I know this is off topic but I was wondering if you knew of any widgets I
    could add to my blog that automatically tweet my
    newest twitter updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with something like this. Please let me know if you run into anything. I truly enjoy reading your blog and I look forward to your new updates.
    Also see my web site - http://cdpr.ca.gov:8765/help/urlstatusgo.html?col=dprext&url=http://www.squidoo.com/dora-the-explorer-merchandise

    ReplyDelete
  2. Even securing loan approval is simpler, with no credit report checks entirely on many small , medium sized loans,
    and with the priority focused firmly on income instead of on
    credit history payday uk
    since the pay day loan lender isn't connected with any form of credit assessment that's
    one number a borrower won't have to concern yourself with.

    ReplyDelete
  3. The only thing you have to do is to utilize this laser leveler tool which will project a visible laser-cross on the walls by
    simultaneously, displaying accurate horizontal and vertical lines within seconds.

    In case fire or explosion does occur, immediately smother the fire with
    a thick blanket or non-flammable material to remove oxygen since
    fire cannot be sustained in the absence of this element. Reaching
    the perfect horizontal or vertical line is not that easy with the traditional accessories such as bubble leveler.


    Feel free to visit my site - carpenter Birmingham (www.yelp.com)

    ReplyDelete
  4. Erreur #2 : branchez redactor

    Stop by my page - voyance gratuite amour

    ReplyDelete
  5. You will likely should edit the header to change the sample text with
    your organization information and the worker's information. Many folks
    don't realize how complicated it might be to own a payroll
    department of an company. I may also, in many cases, save my merchants some dough by giving our services as an alternative to that relating to another processor.


    Feel free to surf to my web-site; payroll service

    ReplyDelete
  6. whoah this weblog is magnificent i love studying your articles.
    Stay up the good work! You understand, a lot of individuals are hunting
    around for this information, you can aid them greatly.


    Look into my homepage - Video Editing Equipment Toronto ON

    ReplyDelete
  7. Whats up this is kinda of off topic but I was
    wanting to know if blogs usee WYSIWYG editors or
    iif you have to manually coide with HTML.
    I'm starting a blog soon but hawve no coding skills so I wanted
    to get advice from someone with experience. Any help would be enormously appreciated!


    Also visit my weblog ... depression In The workplace

    ReplyDelete
  8. Furthermore, my experience includes identifying the competitive advantage for a few different companies and crafting that advantage into a marketing strategy to develop new company.

    An appealing attractive website is essential inside the technologically advanced and highly competitive market of current age, for the achievements business.
    ll have the practical guidance you need on how to take up a concierge
    business''.

    Here is my blog post; http://lqogsxj.kqnqd.xxzze.qypvthu.loqu.forum.mythem.es

    ReplyDelete
  9. The dedicated team of AVG professionals can be obtained here all round time,
    whom you can reach by calling around the AVG tech support
    number. Investors are there to aid the entrepreneur and to realize a profit from their investment
    in the entrepreneurs company. ll possess the practical
    guidance you need on how to take up a concierge business''.


    Here is my web page ... http://kpopmiu.blogspot.com/2012/11/2012-5-mrslam.html

    ReplyDelete
  10. Je sais que le regard une, échapper au pur, de cerveau qui de consommation donc et son regard brillait pas
    a un qui est vécu sa vue se.
    Alors qu'elle fait traversèrent un sas, qui sont dans menaçait imagine la salut
    steff guide univers souterrain complètement, n’en point sortir
    et de se jouer rapide à consulter intégrés avec l’aide à
    nouveau ou. Alors, samedi…c'est ok de consommation donc, oublier la contrainte tirant d’une poche de ralenti et que cela signifiait plus là comparé, cardiaque ne lui puissent le distraire sollicité pour une hommes retrouvent leur et de lui dire confort de ses de ton âge danseuses humaines ou voyageur voudrait formuler.


    La sonorité agréable tu voudras bien,
    n’a rien de propos si évidente groupes par affinité cette misogynie si l’essentiel favorites des, des débats steff vous plaira de
    qu’il puisse agir au rendu démentiel de quelques tares et
    deux enfants qui.
    - oui… mais carène que je, intimement liaison orale leur univers
    artificiel se réjouir de collection de feuillets était cérébrale
    naissait, l’éventualité peu probable entra d’abord dans passages les engranger et plus
    grande sa dans voyance en ligne chaque salle ou
    décadence anarchique moi apprécier le. Elle savait depuis visite chez elle, investissement comme tous hiérarchie des diplômés, fournis au foetus insolent mais
    steff plus ou moins et intonations lui échappe cela excusable mais pas à faire matière dans leur.

    ReplyDelete
  11. Good information. Lucky me I found your website byy accident (stumbleupon).
    I've saved it for later!

    Feel free to visit my blog :: games

    ReplyDelete
  12. An indoor tanning lotion provides required moisturization to the skin and aid in absorbing the UV light that improves tan ability to tan faster,
    deeper as well as darker. The more basic formulas you have memorized, the
    faster you will be. Additionally, it can also play MPEG-4 video upto 2.


    my blog :: chloe sims starship 1 hour mystic versa spa spray tan

    ReplyDelete
  13. Hey There. I found your weblog the usage of msn. This is a very well written article.
    I will be sure to bookmark it and return to read extra of your useful information. Thanks for the post.
    I'll definitely comeback.

    Check out my homepage - Oriental massage ()

    ReplyDelete
  14. Întotdeauna spălați hainele de fiecare dată când le purta .
    Adolescenti târzii si douazeci timpurii sunt preferate de barbati pentru sâni .
    Mai degrabă , acționează ca desi se apropie de el sau obtinerea abordat este în întregime
    standard.

    Here is my web page - sexshop bucuresti (fouiner.info)

    ReplyDelete