Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. .net 2.0 SqlDependency

.net 2.0 SqlDependency

Scheduled Pinned Locked Moved C#
helpcsharpdatabasesales
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    fmardani
    wrote on last edited by
    #1

    Hi, I am trying to get the SqlDependency to work in an application. Here is the problem: One windows application connects to northwind database using a user login. It then diplays the data in the Employees table. Another project is using the the login as the previous App to display the same data BUT it displays an error when it gets to da.Fill(ds, "Customer"); The error is: Message "When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance." string Thanks Here is code that I am using. ds.Clear(); SqlConnection conn = new SqlConnection(txtConnect.Text); conn.Open(); SqlCommand cmd = new SqlCommand(txtSelect.Text, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); //SqlDependency.Start(txtConnect.Text); //test... SqlDependency dep = new SqlDependency(cmd); //The ERROR is on this line.../////// da.Fill(ds, "Employees"); ///////////////////////////////////// grdDemo.DataSource = ds; grdDemo.DataMember = "Employees";

    X 1 Reply Last reply
    0
    • F fmardani

      Hi, I am trying to get the SqlDependency to work in an application. Here is the problem: One windows application connects to northwind database using a user login. It then diplays the data in the Employees table. Another project is using the the login as the previous App to display the same data BUT it displays an error when it gets to da.Fill(ds, "Customer"); The error is: Message "When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance." string Thanks Here is code that I am using. ds.Clear(); SqlConnection conn = new SqlConnection(txtConnect.Text); conn.Open(); SqlCommand cmd = new SqlCommand(txtSelect.Text, conn); SqlDataAdapter da = new SqlDataAdapter(cmd); //SqlDependency.Start(txtConnect.Text); //test... SqlDependency dep = new SqlDependency(cmd); //The ERROR is on this line.../////// da.Fill(ds, "Employees"); ///////////////////////////////////// grdDemo.DataSource = ds; grdDemo.DataMember = "Employees";

      X Offline
      X Offline
      Xodiak
      wrote on last edited by
      #2

      im sorry to see that you're having this problem. i have a library class that does sql connections and returnes data sets, etc. you dont have to use the class but it might help to look at/implement the code and see if you get the same error. Hope this link leads you to a solution to your problem
      http://www.codeproject.com/dotnet/COperationsSQL.asp
      all sqlconnections, commands, data adapters, are encapsulated in this class making things a little bit easier when it comes to interfacing with a sql back end. best of luck

      F 1 Reply Last reply
      0
      • X Xodiak

        im sorry to see that you're having this problem. i have a library class that does sql connections and returnes data sets, etc. you dont have to use the class but it might help to look at/implement the code and see if you get the same error. Hope this link leads you to a solution to your problem
        http://www.codeproject.com/dotnet/COperationsSQL.asp
        all sqlconnections, commands, data adapters, are encapsulated in this class making things a little bit easier when it comes to interfacing with a sql back end. best of luck

        F Offline
        F Offline
        fmardani
        wrote on last edited by
        #3

        Hi, My query is to do with the SqlDependency only. Thanks

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups