Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default Querying SQL Server from Excel

Hi,

I am trying to query a SQL database from Excel. I setup the query and it is
working, however, it prompts me each time to input the password for the SQL
Server.

Is there a way to save the SQL Server password in the excel document so that
i don't have to input it each time?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Querying SQL Server from Excel


James C. wrote:
Hi,

I am trying to query a SQL database from Excel. I setup the query and it is
working, however, it prompts me each time to input the password for the SQL
Server.

Is there a way to save the SQL Server password in the excel document so that
i don't have to input it each time?

Thanks



Be sure sql server is setup in Control panel under Administrative
Tools- DataSources(ODBC)
Where you put in your info, you can substitute stagnant values for
functions if multiple users are using your tool.

Sub GetData()

'SET UP SQL
sql = "Select * from whatever"

'QUERY THE DATA
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=YOURSQLSERVERNAME;UID=YOURUSERNAME;APP=M icrosoft
Office
XP;WSID=YOURCOMPUTERNAME;DATABASE=PUTNAMEOFDATABAS EHERE;Trusted_Connection=Yes"
_
, Destination:=Range("A1"))
.CommandText = sql
.Name = "MySQLQuery"
.FieldNames = True
.RowNumbers = False
.PreserveFormatting = True
.Refresh BackgroundQuery:=False
.Delete
End With
End Sub

Reply
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
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? Richard Excel Discussion (Misc queries) 2 May 13th 23 11:46 AM
Is Excel 95 compatible with Windows 2003 Server? machetero Excel Discussion (Misc queries) 0 March 14th 06 05:18 PM
Retrieving data from database (MS Sql Server) to Excel nwhan Excel Discussion (Misc queries) 0 July 22nd 05 09:35 AM
How to make empty cells as zero in excel add-ins for SQL Server an Microlong Excel Worksheet Functions 0 January 12th 05 06:31 AM
Excel 2003 Database Driver Visual FoxPro 7 on Server 2003. Cindy Winegarden Excel Discussion (Misc queries) 0 November 28th 04 12:07 AM


All times are GMT +1. The time now is 09:23 AM.

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

About Us

"It's about Microsoft Excel"