Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server does not exist- VB.NET sample apps

Status
Not open for further replies.

TerryMc

IS-IT--Management
Apr 29, 2002
19
CA
I keep getting "SQL Server does not exist or access is denied" error when I try to run any of the MS DB sample apps for VB.NET (I am using VS2003)

I am connected to Small Business Server, with SQLSERVER installed (sp3a) and can make all the connections to the Server I want with Server Explorer and view data but the samples won't connect.

This is very frustrating, what am I missing here?
 

Check you didn't miss out Imports System.Data.SqlClient

Dim strSQL As String
Dim strConn As String
Dim objDA As SqlDataAdapter
Dim objDS As New DataSet()

'Build the SQL and Connection strings.
'Change the SQL and Connection strings as per your requirement
strConn = "Initial Catalog=pubs;Data Source=(local);User ID=xxx;password=xxx"

strSQL = "SELECT au_id, au_fname, au_lname FROM authors"

'Initialize the SqlDataAdapter with the SQL and Connection string, and then
'use the SqlDataAdapter to fill teh DataSet with data.
objDA = New SqlDataAdapter(strSQL, strConn)
objDA.Fill(objDS, "authors")

DataGrid1.SetDataBinding(objDS, "authors")


Email: pankajmsm@yahoo.com
 
Thanks PankajBanga

Everything was correct except I needed to change the Data Source =(local) to Data Source= 'Server' as I am not using SQL Server on my local machine.

All these sample apps assume I was using MSDE or SQLServer locally.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top