troubleshooting Question

ASP.net Free online test database

Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland asked on
ASP.NETMicrosoft SQL Server
2 Comments1 Solution16 ViewsLast Modified:
Hi

I have a web app with a GridView that I want to load with data from a cloud SQL database.
For some reason my service provider have changed their settings and I get the following error. Is there perhaps an online data source that I can connect to just to get example data. My code is further on.

  A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) dr2

Imports System.Data.SqlClient
Public Class Contact
    Inherits Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

        If Not IsPostBack Then
            Call Bind_Grid_to_Dataview(Me.GridView1, "Select * From Customers")
        End If

    End Sub

    Sub Bind_Grid_to_Dataview(ByVal oGridView As GridView, ByVal oSQL As String)
        Try


            Dim cs As String = ConfigurationManager.ConnectionStrings("PSQL").ConnectionString
            Dim objCon As New SqlConnection 'Declaring connection object
            objCon.ConnectionString = cs
            'opening connection
            If objCon.State = ConnectionState.Closed Then
                objCon.Open()
            End If
            'declaring new Data Adapter
            Dim objDA As New SqlDataAdapter
            objDA.SelectCommand = New SqlCommand(oSQL, objCon)
            Dim objDS As New DataSet
            objDA.Fill(objDS)
            'Call oCheck_DataSet_For_Blank_Columns(objDS)
            'Below i am creating a default view of the Data Set
            Dim objDV As DataView = objDS.Tables(0).DefaultView
            Session("objDV") = objDV
            oGridView.DataSource = objDV
            oGridView.DataBind()

        Catch ex As Exception
            Response.Write(ex.Message & " dr2")
        End Try
    End Sub
End Class
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros