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. .NET (Core and Framework)
  4. sql server, database stored procedure not working with ip address, please help.

sql server, database stored procedure not working with ip address, please help.

Scheduled Pinned Locked Moved .NET (Core and Framework)
databasehelpsharepointsql-serversysadmin
5 Posts 4 Posters 1 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.
  • M Offline
    M Offline
    Member 14729287
    wrote on last edited by
    #1

    Dear folks.

    I am writing a program for connecting sql server database, and populating data from table using a stored procedure. it is working fine when I use the app.config file's data source as the server name, but when I use the server's ip address and port, it is not working.

    it is showing error, stored procedure not found.

    My app config's connection string is as below.

    But when I use Data Source by name as Data Source=(localdb)\SubdivprojV13; it is working all good. The problem is with ip address and port. I checked the connection, connection is opening. But showing error as stored procedure not found.

    please check my code snippet.

    Public Class Form1
    Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("CONNECTION_FLOR").ConnectionString)
    Private Sub BTN_DISPLAY_Click(sender As Object, e As EventArgs) Handles BTN_DISPLAY.Click
    Dim cmd As New SqlCommand With {
    .Connection = connection,
    .CommandType = CommandType.StoredProcedure,
    .CommandText = "SP_DISPLAY"
    }
    cmd.Connection.Open()
    lbl_CONN.Text = "Connected"
    lbl_CONN.ForeColor = Color.Green

        Dim dt As DataTable = New DataTable()
        dt.Load(cmd.ExecuteReader)
        DataGridView1.DataSource = dt
        DataGridView1.Update()
    
        If connection.State = ConnectionState.Open Then
            connection.Close()
            lbl\_CONN.Text = "DisConnected"
            lbl\_CONN.ForeColor = Color.Red
        End If
    End Sub
    

    End Class

    Any help is highly appreciated. Thanks in advance,.

    Richard DeemingR D C 3 Replies Last reply
    0
    • M Member 14729287

      Dear folks.

      I am writing a program for connecting sql server database, and populating data from table using a stored procedure. it is working fine when I use the app.config file's data source as the server name, but when I use the server's ip address and port, it is not working.

      it is showing error, stored procedure not found.

      My app config's connection string is as below.

      But when I use Data Source by name as Data Source=(localdb)\SubdivprojV13; it is working all good. The problem is with ip address and port. I checked the connection, connection is opening. But showing error as stored procedure not found.

      please check my code snippet.

      Public Class Form1
      Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("CONNECTION_FLOR").ConnectionString)
      Private Sub BTN_DISPLAY_Click(sender As Object, e As EventArgs) Handles BTN_DISPLAY.Click
      Dim cmd As New SqlCommand With {
      .Connection = connection,
      .CommandType = CommandType.StoredProcedure,
      .CommandText = "SP_DISPLAY"
      }
      cmd.Connection.Open()
      lbl_CONN.Text = "Connected"
      lbl_CONN.ForeColor = Color.Green

          Dim dt As DataTable = New DataTable()
          dt.Load(cmd.ExecuteReader)
          DataGridView1.DataSource = dt
          DataGridView1.Update()
      
          If connection.State = ConnectionState.Open Then
              connection.Close()
              lbl\_CONN.Text = "DisConnected"
              lbl\_CONN.ForeColor = Color.Red
          End If
      End Sub
      

      End Class

      Any help is highly appreciated. Thanks in advance,.

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      You are connecting to two different databases. One is a full SQL Server database; the other is a "LocalDB" database. SQL Server Express LocalDB - SQL Server | Microsoft Docs[^] LocalDB databases cannot be accessed across the network.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • M Member 14729287

        Dear folks.

        I am writing a program for connecting sql server database, and populating data from table using a stored procedure. it is working fine when I use the app.config file's data source as the server name, but when I use the server's ip address and port, it is not working.

        it is showing error, stored procedure not found.

        My app config's connection string is as below.

        But when I use Data Source by name as Data Source=(localdb)\SubdivprojV13; it is working all good. The problem is with ip address and port. I checked the connection, connection is opening. But showing error as stored procedure not found.

        please check my code snippet.

        Public Class Form1
        Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("CONNECTION_FLOR").ConnectionString)
        Private Sub BTN_DISPLAY_Click(sender As Object, e As EventArgs) Handles BTN_DISPLAY.Click
        Dim cmd As New SqlCommand With {
        .Connection = connection,
        .CommandType = CommandType.StoredProcedure,
        .CommandText = "SP_DISPLAY"
        }
        cmd.Connection.Open()
        lbl_CONN.Text = "Connected"
        lbl_CONN.ForeColor = Color.Green

            Dim dt As DataTable = New DataTable()
            dt.Load(cmd.ExecuteReader)
            DataGridView1.DataSource = dt
            DataGridView1.Update()
        
            If connection.State = ConnectionState.Open Then
                connection.Close()
                lbl\_CONN.Text = "DisConnected"
                lbl\_CONN.ForeColor = Color.Red
            End If
        End Sub
        

        End Class

        Any help is highly appreciated. Thanks in advance,.

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Thanks for posting the username and password in your connection string. You might want to change that account name and password now and don't ever use that account name ever again.

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
        Dave Kreskowiak

        Richard DeemingR 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Thanks for posting the username and password in your connection string. You might want to change that account name and password now and don't ever use that account name ever again.

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
          Dave Kreskowiak

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          It's not even a private IP address! :laugh: Looks like the OP is using Verizon as their ISP. I wonder whether they've managed to open port 1433 up to the internet? :evilgrin:


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          1 Reply Last reply
          0
          • M Member 14729287

            Dear folks.

            I am writing a program for connecting sql server database, and populating data from table using a stored procedure. it is working fine when I use the app.config file's data source as the server name, but when I use the server's ip address and port, it is not working.

            it is showing error, stored procedure not found.

            My app config's connection string is as below.

            But when I use Data Source by name as Data Source=(localdb)\SubdivprojV13; it is working all good. The problem is with ip address and port. I checked the connection, connection is opening. But showing error as stored procedure not found.

            please check my code snippet.

            Public Class Form1
            Dim connection As New SqlConnection(ConfigurationManager.ConnectionStrings("CONNECTION_FLOR").ConnectionString)
            Private Sub BTN_DISPLAY_Click(sender As Object, e As EventArgs) Handles BTN_DISPLAY.Click
            Dim cmd As New SqlCommand With {
            .Connection = connection,
            .CommandType = CommandType.StoredProcedure,
            .CommandText = "SP_DISPLAY"
            }
            cmd.Connection.Open()
            lbl_CONN.Text = "Connected"
            lbl_CONN.ForeColor = Color.Green

                Dim dt As DataTable = New DataTable()
                dt.Load(cmd.ExecuteReader)
                DataGridView1.DataSource = dt
                DataGridView1.Update()
            
                If connection.State = ConnectionState.Open Then
                    connection.Close()
                    lbl\_CONN.Text = "DisConnected"
                    lbl\_CONN.ForeColor = Color.Red
                End If
            End Sub
            

            End Class

            Any help is highly appreciated. Thanks in advance,.

            C Offline
            C Offline
            C0ding_j3ff
            wrote on last edited by
            #5

            I'm really sorry not being able to give you a good solution for this problem you are describing. However, I recommend you going to the tech forum on Craiglist. You could find an answer over there.

            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