Group:  Microsoft Excel ยป microsoft.public.excel.querydao
Thread: SQL Server Connection String fro Stored Procedure

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

SQL Server Connection String fro Stored Procedure
Candyman 10.11.2005 00:32:36
I have Excel 2003. I am trying to run a code to connect to an ODBC and run a
stored procedure. I can not connect. Please help. The code looks something
like:

Sub SetTrigger_LOCK_Reports()
Dim db1 As QueryTable
DBName = "MY_Reports"
sqlstring = "MY_Reports.dbo.spSetReportLinkAvailability ([ at ]isActive =
0,[ at ]message = 'Current reports are being processed at this time.)"

myUID = "ItsMe"
myPWD = "No_Really!"

connstring = _
"ODBC;DSN=MY_Reports;" _
& "UID= " & myUID & ";" _
& "PWD= " & myPWD & ";" _
& "Database=MY_Reports"
Application.Workbooks.OpenDatabase Filename:=connstring
'execute MY_Reports.dbo.spSetReportLinkAvailability ([ at ]isActive = 0,[ at ]message
= 'Current reports are being processed at this time.')
MsgBox (db1.Name)
'db1.Close
Range("STATUS").Value = "Locked"
End Sub

What am I doing wrong? Do need the Driver or the name of the DB Server?
I a lost!
TIA
Candyman

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net