LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default SQL server does not exist or access denied

Can i know why my coding here diplay the error SQL server does not exist or
access denied?

Public Sub GetColNum(ByRef colCount As Integer)

Dim con, recordSet, cmdText

'Create a connection to ms sql server
Set con = CreateObject("ADODB.Connection")
Set recordSet = CreateObject("ADODB.Recordset")

con.Provider = "SqlOleDB"
con.Properties("Data Source").Value = "BBIPROD"
con.Properties("Initial Catalog").Value = "bbiprod"
con.Properties("Integrated Security").Value = "SSPI"

' con.ConnectionString = driver=SQL Server};" &
"server=cindy;uid=Cindy;pwd;database=pubs"

con.Open

'Prepare command string to get number of columns
cmdText = "SELECT count(*) as column_num from information_schema.columns
where table_name = 'tbl_request'"

'Open connection
recordSet.Open cmdText, con
colCount = recordSet.Fields("column_num")


MsgBox ("In Getcolumn() " + Str(colCount))

'Close and set to nothing
recordSet.Close
con.Close

Set recordSet = Nothing
Set con = Nothing


End Sub


Thank you very much oh.....cos i am first time using databace connection.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200602/1
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Denied LE94553 Excel Discussion (Misc queries) 0 December 4th 07 01:29 AM
Access denied richn Excel Discussion (Misc queries) 4 October 30th 07 01:07 AM
Worksheet Access Denied Nick Excel Discussion (Misc queries) 3 July 7th 05 02:48 PM
file delete in Excel receives permission denied by Server 2003 phurst Excel Programming 2 March 10th 05 09:43 PM
462 The remote server machine does not exist? Damon[_2_] Excel Programming 1 December 1st 04 12:17 PM


All times are GMT +1. The time now is 04:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"