TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
siri
NA
45
28.2k
connection error plz help me out
Jan 12 2012 7:30 AM
hai all as iam doing vb application .by using sqlserver 2005 after debuging its shwoing me this error can any one plz tell me how to provide connection ????
as i paste coding that i wrote for sample application
ERROR::getting this error so plz tell me how to overcome this error ....
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
coding ..............
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Dim dr As SqlClient.SqlDataReader
Dim connectionstring As String = System.Configuration.ConfigurationSettings.AppSettings("DBCon")
Dim cn As New SqlConnection(connectionstring)
Dim dt As New DataTable
Dim ds As New DataSet
Dim adap As New SqlDataAdapter
Dim cmd As New SqlCommand
Dim sqlquery As String = ""
Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click
If cn.State = ConnectionState.Closed Then cn.Open()
' cn.Open()
sqlquery = "insert into tbl_siri(sname,saddress) values('" & txtname.Text & "','" & txtadd.Text & ")"
cmd = New SqlCommand(sqlquery, cn)
cmd.ExecuteNonQuery()
MsgBox("successfully saved...")
End Sub
Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click
txtadd.Text = ""
txtname.Text = ""
End Sub
End Class
in app config------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections >
</configSections>
<appSettings >
<add key ="DBCon" value ="Data source=SU86;user id=;password=;database=siri"/>// as there is no id and pwd as iam doing using windows authentication so shall i want to mention id n pwd here r not
</appSettings>
</configuration>
Reply
Answers (
5
)
VB DOT NET query plz help me
refresh current asp.net form using c#