Navigation:  thinBasic language > Script structure > Pre Parsing directives > #INCLUDE >

#INCLUDE "Includes\DB.inc"

Previous pageReturn to chapter overviewNext page

 

Global gDBConnection       As DWORD

Global gDBConnectionString As String

'-------------------------------------------------------------------------

' .

'-------------------------------------------------------------------------

Function SiteDB_Open() As Long

 

'---Creates an ADO connection object

gDBConnection = ADO_CreateObject("ADODB.Connection")

If ISFALSE gDBConnection Then

  echo "Connection: " & gDBConnection & "<br>Ado result: " & ADO_Result & "<br>"

  STOP

End If

'---Connection string

gDBConnectionString = LL_DataByName(gConfig, "DB_ConnString")

'---Opens database

ADO_Connection_Open(gDBConnection, gDBConnectionString)

 

If ADO_Result Then

  Echo "Connection open error: " & ADO_Result & "<br>"

  STOP

End If  

 

End Function

 

'-------------------------------------------------------------------------

' .

'-------------------------------------------------------------------------

Function SiteDB_Close() As Long

 

'---Close and release the connection

If gDBConnection Then

  ADO_Connection_Close(gDBConnection)

  ADO_Release(gDBConnection)

End If

 

End Function

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com