Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 June 21st, 2007, 10:36 AM
Registered User
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default HELP: trying to connect to SQL DB

I am trying to connect to a SQL DB and I have owner access, but I am unable to connect.

Here is my connectionstring:

Dim connectionString As String = _
"Data Source=db server name" & _
"Initial Catalog=name;Integrated Security=true"
Dim theDatabase As New SqlClient.SqlConnection(connectionString)


and the error I get is:

(Priovider: Named Pipes Provider, Error: 40 - could not open a connection to SQL server)
the details state that under default settings SQL server does not allow remote connection.


I don't know if this is any help to you all out there, but I ran a debug and found this:

Error for : theDatabase.Open()

EXECUTE permission denied on object 'sp_sdidebug', database 'master', owner 'dbo'

Here is the start of my code (connection wise)...I'm new to this type of VB application:

Imports System.Data.SqlClient
Imports System.Data
Imports System.Data.Sql
Imports System.Data.SqlClient.SqlException

Public Class Form1

Private Sub adddefectbutton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles adddefectbutton.Click
'When Clicked the Data will be insterted into the database.

'-------Connect to the Database

Dim connectionString As String = "Data Source=san-sql.corp.advertising.com;Initial Catalog=Ontimetesting;Integrated Security=true;"

Dim theDatabase As New SqlClient.SqlConnection(connectionString)


I hope all the information I provided helps: I need help on this, please.

I've tried everything I can think of...any ideas?

Old June 21st, 2007, 05:34 PM
Wrox Author
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

This error:
EXECUTE permission denied on object 'sp_sdidebug', database 'master', owner 'dbo'

tells me that you ARE connection to the database because it means that the user that you have connect to SQL through, does not have EXECUTE permissions in the master database, hence:

exec sp_sdidebug

will error out for you.

As for your named pipe error, this MSDN Blog should help you out:

================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
================================================== =========
Why can't Programmers, program??
================================================== =========

Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't connect to the sql 2005 developer DB gulfpaddler BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 16 August 21st, 2008 04:17 AM
Connect to DB hernann C# 2005 2 July 31st, 2006 05:06 PM
Need to connect to SQL DB in VB app codehappy VB How-To 3 April 21st, 2005 12:03 AM
connect to sql db jopay Visual C++ 0 January 12th, 2005 05:17 PM
how i can connect to remote sql server db yoord ADO.NET 16 June 16th, 2004 01:40 AM

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