Difference between revisions of "ISDBDatabase::OpenSQL"

From MediaMonkey Wiki
Jump to: navigation, search
 
(note about locking errors, style)
 
Line 1: Line 1:
{{MethodDeclaration|SDBDatabase|ISDBDatabase|Function OpenSQL(SQL As String) As Object}}
+
{{MethodDeclaration|SDBDatabase|ISDBDatabase|Function OpenSQL(SQL As String) As [[SDBDBIterator]]}}
  
 
===Parameters===
 
===Parameters===
Line 12: Line 12:
 
===Example code===                     
 
===Example code===                     
 
<source lang="vb">
 
<source lang="vb">
Set Iter = SDB.Database.OpenSQL( "SELECT DISTINCT TextData FROM AddSongInfo WHERE DataType=200 Order BY TextData")
+
Set Iterator = SDB.Database.OpenSQL("SELECT DISTINCT TextData FROM AddSongInfo WHERE DataType=200 Order BY TextData")
  
While Not Iter.EOF
+
While Not Iterator.EOF
   ' do something here....
+
   ' Do something here ...
   Iter.Next
+
   Iterator.Next
 
WEnd
 
WEnd
 +
Set Iterator = Nothing ' Avoid locking errors
 
</source>
 
</source>
  

Latest revision as of 22:51, 20 April 2013

CoClass SDBDatabase, Interface ISDBDatabase

Function OpenSQL(SQL As String) As SDBDBIterator


Parameters

Name Type Description
SQL String SQL string specifying the query.


Method description

Returns SDBDBIterator object with records specified by SQL parameter.

Example code

Set Iterator = SDB.Database.OpenSQL("SELECT DISTINCT TextData FROM AddSongInfo WHERE DataType=200 Order BY TextData")

While Not Iterator.EOF
   ' Do something here ...
  Iterator.Next
WEnd
Set Iterator = Nothing ' Avoid locking errors