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. SQL Connection Problem

SQL Connection Problem

Scheduled Pinned Locked Moved C#
helpdatabasesysadminquestion
5 Posts 3 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.
  • E Offline
    E Offline
    Emmet_Brown
    wrote on last edited by
    #1

    Hello I've got a comboBox and I want to make a query after a change in the selected item is done. Inside the "comboBox1_SelectedIndexChanged" function, I wrote these:

    string ogretisim;
    ogretisim = comboBox1.Text;
    SqlConnection conn = null;

    conn = new Sqlconnection("Data Source = Veritabani.sdf");
    conn.Open()
    conn.Close();

    I did not do the query yet, just to try. In the runtime, conn.Open() gives an error like it cannot reach the server. What can be the problem? note: I've tried all of these:

    newSqlConnection("Data Source = baglanXXX");
    newSqlConnection("Data Source = Veritabani.sdf");
    newSqlConnection("Data Source = .\\Veritabani.sdf");
    newSqlConnection("Data Source = VeritabaniDataSet.xsd");
    newSqlConnection("baglanXXX");

    ("baglanXXX" is my connection string) please someone help :(

    S J E 3 Replies Last reply
    0
    • E Emmet_Brown

      Hello I've got a comboBox and I want to make a query after a change in the selected item is done. Inside the "comboBox1_SelectedIndexChanged" function, I wrote these:

      string ogretisim;
      ogretisim = comboBox1.Text;
      SqlConnection conn = null;

      conn = new Sqlconnection("Data Source = Veritabani.sdf");
      conn.Open()
      conn.Close();

      I did not do the query yet, just to try. In the runtime, conn.Open() gives an error like it cannot reach the server. What can be the problem? note: I've tried all of these:

      newSqlConnection("Data Source = baglanXXX");
      newSqlConnection("Data Source = Veritabani.sdf");
      newSqlConnection("Data Source = .\\Veritabani.sdf");
      newSqlConnection("Data Source = VeritabaniDataSet.xsd");
      newSqlConnection("baglanXXX");

      ("baglanXXX" is my connection string) please someone help :(

      S Offline
      S Offline
      spiritboy
      wrote on last edited by
      #2

      try

      new SqlConnection(@"Server = .\sqlexpress; database = YourDbName ; integrated security = sspi;");

      J 1 Reply Last reply
      0
      • S spiritboy

        try

        new SqlConnection(@"Server = .\sqlexpress; database = YourDbName ; integrated security = sspi;");

        J Offline
        J Offline
        J4amieC
        wrote on last edited by
        #3

        How could you tell he was using sql express?

        1 Reply Last reply
        0
        • E Emmet_Brown

          Hello I've got a comboBox and I want to make a query after a change in the selected item is done. Inside the "comboBox1_SelectedIndexChanged" function, I wrote these:

          string ogretisim;
          ogretisim = comboBox1.Text;
          SqlConnection conn = null;

          conn = new Sqlconnection("Data Source = Veritabani.sdf");
          conn.Open()
          conn.Close();

          I did not do the query yet, just to try. In the runtime, conn.Open() gives an error like it cannot reach the server. What can be the problem? note: I've tried all of these:

          newSqlConnection("Data Source = baglanXXX");
          newSqlConnection("Data Source = Veritabani.sdf");
          newSqlConnection("Data Source = .\\Veritabani.sdf");
          newSqlConnection("Data Source = VeritabaniDataSet.xsd");
          newSqlConnection("baglanXXX");

          ("baglanXXX" is my connection string) please someone help :(

          J Offline
          J Offline
          J4amieC
          wrote on last edited by
          #4

          The problem is that you don't understand connection strings. http://www.connectionstrings.com/[^] for info.

          1 Reply Last reply
          0
          • E Emmet_Brown

            Hello I've got a comboBox and I want to make a query after a change in the selected item is done. Inside the "comboBox1_SelectedIndexChanged" function, I wrote these:

            string ogretisim;
            ogretisim = comboBox1.Text;
            SqlConnection conn = null;

            conn = new Sqlconnection("Data Source = Veritabani.sdf");
            conn.Open()
            conn.Close();

            I did not do the query yet, just to try. In the runtime, conn.Open() gives an error like it cannot reach the server. What can be the problem? note: I've tried all of these:

            newSqlConnection("Data Source = baglanXXX");
            newSqlConnection("Data Source = Veritabani.sdf");
            newSqlConnection("Data Source = .\\Veritabani.sdf");
            newSqlConnection("Data Source = VeritabaniDataSet.xsd");
            newSqlConnection("baglanXXX");

            ("baglanXXX" is my connection string) please someone help :(

            E Offline
            E Offline
            Emmet_Brown
            wrote on last edited by
            #5

            thank you for replies, I'll work on it a bit further, thanks again =)

            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