Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default creating a query using MSQuery

Hi all,

I usually create a query by creating an appropriate DSN in my control panel, then choosing that MSN from MSQuery when it fires up in Excel.

The data is then returned to the sheets etc etc.

This means that each user that wants to run the spreadsheet and refresh data needs to have the correct DSN set up (same name)
Is there an alternative to this, so that end users do not need the DSN created? They can just open the spreadsheet and refresh..


Thanks in advance,
Matt
  #2   Report Post  
Junior Member
 
Posts: 1
Default

Quote:
Originally Posted by matpj View Post
I usually create a query by creating an appropriate DSN in my control panel, then choosing that MSN from MSQuery when it fires up in Excel.

The data is then returned to the sheets etc etc.

This means that each user that wants to run the spreadsheet and refresh data needs to have the correct DSN set up (same name)
Is there an alternative to this, so that end users do not need the DSN created? They can just open the spreadsheet and refresh..
Hi Matt -

Does MSQuery let you specify ADO.NET connection strings? If so, you can use them to give a full connection string, rather than just an ODBC DSN - you can get details of the connection string you would need from www.connectionstrings.com. Then your users wouldn't need to create the DSN on their machine.

If it doesn't let you use ADO.NET data providers, you could try building the spreadsheet using a product that I work on, Resolver One (www.resolversystems.com). It's scripted with IronPython, which means you can use all of the .NET APIs. So for example, you could enter the code as:

from System.Data.SqlClient import SqlConnection

connection = SqlConnection('Data Source=database server; Initial Catalog=db; other connection string details...)
connection.Open()
command = connection.CreateCommand()
command.CommandText = 'select * from table' # your SQL statement here...
reader = command.ExecuteReader()

# and then add code to populate the worksheet from the reader...

Then you could have formulae in the spreadsheet that use the data pulled in from the database.
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
Creating a profit and loss from MSQuery Data c ryner Excel Discussion (Misc queries) 2 May 12th 08 02:35 PM
Creating spreadsheet from access query. projectmergeleader Excel Discussion (Misc queries) 1 September 6th 07 03:48 PM
msquery odbc -- excel repeats query on return [email protected] Excel Discussion (Misc queries) 0 April 3rd 06 06:22 PM
Creating a Web Query Louise Excel Worksheet Functions 4 November 3rd 05 01:29 PM
Multiple ODBC Database lik in one MSQUERY query Alain79 Excel Discussion (Misc queries) 0 September 13th 05 12:25 PM


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

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"