View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sauron[_17_] Sauron[_17_] is offline
external usenet poster
 
Posts: 1
Default DSN-Less Connections

Hi All,

Having a spot of difficulty doing a DSN-Less connection would anyone b
able to see what is wrong with the following code please? It keep
coming back with;

"datasource name not found and no default driver specified"

when I try opening the connection;

ecpsrvConnection.Open ecpsrvConnect

I've tried http://www.able-consulting.com/ADO_Conn.htm and variou
other sites with example connection strings. Nothing works...

Thanks All, as always very much appreciated!

Sau

*-*-*-*

Function ecpsrvDBCons()

Dim ecpsrvLogin As String
Dim ecpsrvPassword As String
Dim ecpsrvname As String
Dim ecpsrvConnect As String
Dim ecpsrvConnection As ADODB.Connection

ecpsrvLogin = "sa"
ecpsrvPassword = vbNullString
ecpsrvname = "ECPSRV;"

ecpsrvConnect = "ODBC;Provider={SQL Server};" & _
"Server=" & ecpsrvname & ";" _
& "Database=Concorde" & ";" _
& "Uid=" & ecpsrvLogin & ";" _
& "Pwd=" & ecpsrvPassword & ";"


End Function
Call ecpsrvDBCons

Dim sQuery1 As String
Dim ecpsrvRecordset As ADODB.Recordset
Dim ecpsrvCommand As ADODB.Command

Set ecpsrvConnection = New ADODB.Connection
ecpsrvConnection.Open ecpsrvConnect

Set ecpsrvCommand = New ADODB.Command
Set ecpsrvCommand.ActiveConnection = ecpsrvConnect

sQuery1 = ""
sQuery1 = sQuery1 & " SELECT COUNT * "
sQuery1 = sQuery1 & " FROM " & "tbl_patient.lastname

--
Message posted from http://www.ExcelForum.com