Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 27 Sep 2002 @ 11:35:36 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: Executing a Macro using ADO or DAO
 
From:   Jim Downey

I am working on this very issue for a small application. I am by no means a VB or asp programmer but this works for me:

I pass a text string to be used as a caption and the sql statement to be run. The output is an HTML table statement which in this case is just written directly to the screen. I have a sub routine called output that just calls response.write

'Write output to the screen
Sub Output(X)
      Response.Write X
End Sub

The record set is open only during the life of your asp page. when you go to another page, you lose the recordset. You have to read the recordset then do something with it. Small record sets can be saved as hidden input fields and passed from form to form. Larger record sets might be written to a database local to the asp page. The next page uses either the userid or session id to read the subset you are interested in.

'----------------------------------------------------------------------
Sub RunSQL(caption,sql)

'Logon Teradata
      Set cnnRepos = Server.CreateObject("ADODB.Connection")
      cnnRepos.Open "Teradata", UserId, Password

'Execute SQL
      Output DATE & TIME & "SQL:
" & sql Set rs = cnnRepos.Execute(sql) Output DATE & TIME & "
SQL Complete
" 'Display results as a Table Output "
" Output "" Output "" i=0 Do While i < rs.Fields.Count Output "" i=i+1 Loop Output "" rs.MoveFirst While Not rs.EOF Output "" i=0 Do While i < rs.Fields.Count Output "" i=i+1 Loop Output "" rs.MoveNext Wend Output "
" & caption & "
" & rs.Fields(i).Name & "
" & rs.Fields(i) & "

" rs.Close cnnRepos.Close End Sub


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023