CISA FotoGallery


Tot. visite contenuti : 928258
Home Articoli tecnici Query e viste Creare Qry Pass_through temporanee

Creare Qry Pass_through temporanee

'Tratto da Articolo Microsoft Knowledge Base - 210323

Function ExecuteSPT (sqltext As String, connectstring As String)

' Purpose: Esegue una temporanea query pass-through.
' Accepts: sqltext: Stringa SQL da eseguire.
' connectstring: Connection string, deve seguire il predicato "ODBC;".
' Returns: nothing.

Dim mydb As DAO.Database, myq As DAO.QueryDef
Set mydb = DBEngine.Workspaces(0).Databases(0)

' Create a temporary QueryDef object that is not saved.
Set myq = mydb.CreateQueryDef("")

' Set the ReturnsRecords property to False in order to use the
' Execute method.

myq.returnsrecords = False

myq.connect = connectstring
myq.sql = sqltext


End Function