Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
Is Excel 95 compatible with Windows 2003 Server? | Excel Discussion (Misc queries) | |||
Retrieving data from database (MS Sql Server) to Excel | Excel Discussion (Misc queries) | |||
How to make empty cells as zero in excel add-ins for SQL Server an | Excel Worksheet Functions | |||
Excel 2003 Database Driver Visual FoxPro 7 on Server 2003. | Excel Discussion (Misc queries) |