Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > Visual Web Developer 2005
|
Visual Web Developer 2005 Discuss creating ASP.NET 2.0 sites with Microsoft's Visual Web Developer 2005. If your question is more specific to a piece of code than the Visual tool, see the ASP.NEt 2.0 forums instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 24th, 2006, 06:07 AM
Authorized User
 
Join Date: Feb 2006
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Default anyone can help with sql connection problems

hi guys, :)
i am very happy that i found this forum which discuss ASP.net.
i am new to ASP.net 2.0 and need some serious help. when i debug my application and try to insert data an error occur saying:

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

the code that i have used to submit data is as follow:

Imports System.Data.SqlClient
...
  Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click

      Dim objConn As SqlConnection
      Dim objCmd As SqlCommand

objconn = New SqlConnection("Server=localhost; Database=ecb;user
ID='';Password=''")

objCmd = New SqlCommand("INSERT INTO staff (firstname, surname) VALUES (@firstname, @surname,)", objConn)

objCmd.Parameters.Add("@FirstName", Data.SqlDbType.VarChar).Value = txtFirstName.Text
objCmd.Parameters.Add("@Surname", Data.SqlDbType.VarChar).Value = txtSurname.Text

objConn.Open()
objCmd.ExecuteNonQuery()
objConn.Close()

can anyone help? thank you in advanced


 
Old February 24th, 2006, 01:17 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Cross-post. Please see here: http://p2p.wrox.com/topic.asp?TOPIC_ID=40541 for details.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 22nd, 2006, 09:57 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The connection string seems to have the userid="". I feel there cannot be a connection established without a userid. So, try giving a default sa userid and appropriate password and try to connection.


Cheers,
Kiran






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to simulate connection problems FileFound General .NET 3 August 12th, 2008 03:30 PM
Connection problems with Full Sql Server Lightwaver BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 13 February 12th, 2007 08:30 AM
SQL connection problems username passwords beatniks BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 6 August 16th, 2006 11:45 AM
Database Connection Problems Roy Ng Dreamweaver (all versions) 3 August 15th, 2005 09:36 AM
Access Database Connection Problems jdmeier Classic ASP Databases 1 August 13th, 2003 10:22 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.