Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Access Denied | Excel Discussion (Misc queries) | |||
Access denied | Excel Discussion (Misc queries) | |||
Worksheet Access Denied | Excel Discussion (Misc queries) | |||
file delete in Excel receives permission denied by Server 2003 | Excel Programming | |||
462 The remote server machine does not exist? | Excel Programming |