Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 8th, 2005, 11:03 AM
sjm sjm is offline
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cannot display/return SQL Query Output from a Vari



I have been having a very difficult time trying to get the output of a sql query that is in a DTS global variable to return, presently to a messagebox.

I created an Execute SQL task with the query I wish to use. The query has been tested in Query Analyzer and works fine and returns the results I am looking for. I set a global variable to the result set. Basically, I wish to display the results as a string or similar in a messagebox.

I have created the Execute SQL task as described in http://msdn.microsoft.com/library/en..._task_4gkl.asp .

I have tried to retrieve the results using the example in
http://msdn.microsoft.com/library/de..._task_6llt.asp but I have been unable to do so.

I also tried the GetString method of the recordset without success.

I also tried the using the “Storing the resultset in a flat file” example from http://dotnetbips.com/displayarticle.aspx?id=228 and I was unable to write the recordset to a file.

What is the proper way to display a variable of type dispatch? I feel like I am going about this the wrong way.

I welcome suggestions and comments on how to achieve the goal of displaying the query results.

Thanks.




  #2 (permalink)  
Old September 9th, 2005, 11:40 AM
sjm sjm is offline
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Everything is fine with the code listed below. I am going to use this
instead of the DTS execute sql task.


Option Explicit


Function Main()


dim cnn
dim rs
dim intLoop
dim strText


set cnn=createobject("ADODB.Connec­tion")


cnn.Open "Provider=sqloledb;" & _
           "Data Source=SERVER;" & _
           "Initial Catalog=msdb;" & _
           "Integrated Security=SSPI"


set rs=cnn.execute("SQL QUERY")


If rs.BOF then


msgbox "No Records Found"


else


do until rs.EOF


For intLoop = 0 To rs.Fields.Count - 1


strText = strText & rs.fields(intLoop).value & " " & vbCrLf


Next


rs.MoveNext


loop


msgbox strText


end if


set rs = nothing


Main = DTSTaskExecResult_Success


End Function




 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Query output to XML using BCP HELP!! miamikk SQL Language 3 May 15th, 2009 08:22 AM
Output Query to txt file from SQL Query everest SQL Server 2005 4 November 22nd, 2007 01:49 AM
Sql query output to XML or HTML file miamikk SQL Language 4 June 6th, 2007 03:58 AM
Return output variable to VB from SQL stored proc busterbunny BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 March 27th, 2006 10:24 PM
Display text data in textarea from SQL query palvin Classic ASP Professional 13 November 30th, 2005 05:52 PM



All times are GMT -4. The time now is 10:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.