Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

SQL Serer not found, Could not Open Connection, etc...

$
0
0
Posted Image
Hey Friends,
In My App error given, i dont know whats this,

Error : "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)"

Public Class DBClass
    Dim cn As New SqlClient.SqlConnection("Data Source=localhost;Initial Catalog=SchoolManagementSystem;Integrated Security=True")
    Dim cmd As New SqlClient.SqlCommand
    Dim tbl As New DataTable
    Dim da As New SqlClient.SqlDataAdapter
    Dim sql As String
    'Insert/Delete/Update
    Sub RunInsertDeleteUpdateQry(ByVal sql As String)
        cn.Open()
        cmd.Connection = cn
        cmd.CommandText = sql
        cmd.ExecuteNonQuery()
        cn.Close()
    End Sub
    'Run Select Qry
    Public Function GetRecords(ByVal sql As String) As DataTable
        tbl = New DataTable
        da = New SqlClient.SqlDataAdapter(sql, cn)
        da.Fill(tbl)
        Return tbl
    End Function

End Class


Please Help Me,,
Thank You In Adv...

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>