code in Visual Basic
Code: Select all
'-------------------------------------------------------------------
' CreateNewDataBase.BAS (c)2003 by Ricardo Daniel Ponce
' Source code in VisualBasic 6.0
'
' May 2003
' Púlsar 3.0 (c)2003 by Ricardo Daniel Ponce
' rponce@lanet.com.ar
'
' HEPIKA SOLUTIONS
' We are programmers... as you
' www.hepika.com.ar
'
'This file show how to view all records saved in a database
'with Púlsar 3.0
'
'-------------------------------------------------------------------
'
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'PULSAR 3.0 Full
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Declare Function PULSARBUILD Lib "pulsar.dll" () As String
Declare Function PULSARENGINE Lib "pulsar.dll" () As String
Declare Function NEWCONVENTIONALDB Lib "pulsar.dll" (Structure$, IndexField$, DataBasePath$, DataBaseFile$) As String
Declare Function NEWMEMODB Lib "pulsar.dll" (Structure$, IndexField$, DataBasePath$, DataBaseFile$) As String
Declare Function NEWCONVENTIONALENCDB Lib "pulsar.dll" (Structure$, IndexField$, DataBasePath$, DataBaseFile$) As String
Declare Function NEWMEMOENCDB Lib "pulsar.dll" (Structure$, IndexField$, DataBasePath$, DataBaseFile$) As String
Declare Function CHANGEPASSWORD Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, OldPassword$, NewPassword$) As String
Declare Function SAVEINDEXCONVDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$) As String
Declare Function SAVEINDEXCONVENCDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, Password$) As String
Declare Function SAVEINDEXMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, MemoField$) As String
Declare Function SAVEINDEXMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, MemoField$, Password$) As String
Declare Function GETQUANTITYOFRECORDS Lib "pulsar.dll" (DataBasePath$, DataBaseFile$) As String
Declare Function GETRECORDCONVDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$) As String
Declare Function GETRECORDCONVDBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$, Password$) As String
Declare Function GETRECORDMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$, MemoField$) As String
Declare Function GETRECORDMMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$, MemoField$, Password$) As String
Declare Function SINECONVDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$) As String
Declare Function SINECONVDBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, Password$) As String
Declare Function SINEMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, MemoField$) As String
Declare Function SINEMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, MemoField$, Password$) As String
Declare Function SAVECONVDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$) As String
Declare Function SAVECONVENCDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, Password$) As String
Declare Function SAVEMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, MemoField$) As String
Declare Function SAVEMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordToSave$, MemoField$, Password$) As String
Declare Function REINDEXCONVDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$) As String
Declare Function REINDEXCONVDBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, Password$) As String
Declare Function REINDEXMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$) As String
Declare Function REINDEXMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, Password$) As String
Declare Function RETURNRECORDBYTE Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$) As String
Declare Function SARINDEXCONDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, DataToSearch$) As String
Declare Function SARBYTECONDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, DataToSearch$) As String
Declare Function SARINDEXCONDBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, DataToSearch$, Password$) As String
Declare Function SARBYTECONDBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, DataToSearch$, Password$) As String
Declare Function SARINDEXMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, DataToSearch$) As String
Declare Function SARBYTEMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, DataToSearch$) As String
Declare Function SARINDEXMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, DataToSearch$, Password$) As String
Declare Function SARByteMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, DataToSearch$, Password$) As String
Declare Function DELETERECORDCONVDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$) As String
Declare Function DELETERECORDCONVDBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$, Password$) As String
Declare Function DELETERECORDMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$) As String
Declare Function DELETERECORDMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, RecordNumber$, Password$) As String
Declare Function MODIFYRECORDCONVDB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, NewRecordInDB$, RecordToModify$) As String
Declare Function MODIFYRECORDCONVDBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, NewRecordInDB$, RecordToModify$, Password$) As String
Declare Function MODIFYRECORDMEMODB Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, NewRecordInDB$, MemoField$, RecordToModify$) As String
Declare Function MODIFYRECORDMEMODBENC Lib "pulsar.dll" (DataBasePath$, DataBaseFile$, NewRecordInDB$, MemoField$, RecordToModify$, Password$) As String
'Record defined in UDT (User Defined Types) for this demostration.
'This structure is used by NewConventionalDB$ packed function
'in the database creation and others functions during the access
'operations into database
Type Fields
Apellido As String * 30 'last name field
Nombres As String * 40 'first name field
Email As String * 20 'e-mail field
Web As String * 50 'web field
End Type
Global DatabaseRecord As Fields 'Database Record used in this program
Sub MAIN()
'------------------------------------------------------------------
'BEGIN DEMO
'------------------------------------------------------------------
MsgBox "BEGIN DEMO: HOW CREATE A NEW DATABASE.", , "PULSAR 3.0 - DATABASE MANAGER"
'variables used in this program
PulsarPath$ = "c:\pulsar" 'the database file is saved in this path
PulsarFile$ = "Conventional_DB" 'database filename
'--------------------------------------------------------------------
'HOW TO CREATE A NEW CONVENTIONAL DATABASE?
'
'NewConventionalDB$ packed function allow create a new database file
'in your disk. Use the Structure$ variable to define the structure
'coincident with the UDT:
'TYPE Fields
' Apellido AS STRING * 30 'last name field
' Nombres AS STRING * 40 'first name field
' Email AS STRING * 20 'e-mail field
' Web AS STRING * 50 'web field
'END TYPE
'GLOBAL DatabaseRecord is used in this program for contain UDT structure
'
'The IndexField$ variable define the index field for ordering the data
'into file
Structure$ = "APELLIDO:30,NOMBRES:40,E-MAIL:20,WEB:50"
IndexField$ = "APELLIDO"
CallPulsar$ = NEWCONVENTIONALDB$(Structure$, IndexField$, PulsarPath$, PulsarFile$)
If CallPulsar$ <> "ok" Then
'If database file is created, the packed function return "ok".
'If error occur, function return error code in string
'format: "ERROR CODE:xxx...." (xxx is error code -see púlsar manual-)
MsgBox "OPERATION IS NOT COMPLETED: " + CallPulsar$
Else
'database is created
MsgBox "OPERACION OK."
End If
'------------------------------------------------------------------
MsgBox "¡THE END!", , "PULSAR DATABASE MANAGER"
End Sub
Code: Select all
;-------------------------------------------------------------------
; CreateNewDatabase.bas (c)2002 by Ricardo Daniel Ponce
; Source code in PureBasic
; Código fuente en PureBasic
;
; Noviembre del 2002
; November 2002
;
; Púlsar 3.0 (c)2002 by Ricardo Daniel Ponce
; rponce@lanet.com.ar
;
; HEPIKA SOLUTIONS HEPIKA SOLUTIONS
; Somos programadores... como usted We are programmers... as you
; www.hepika.com.ar www.hepika.com.ar
;
; Funciones empaquetadas para operar Púlsar 3.0
; Packed Functions For operate Púlsar 3.0
;-------------------------------------------------------------------
;DECLARACION DE SUBRUTINAS PARA OPERAR PULSAR 3.0 CON PureBasic
;Sub declarations To operate Púlsar 3.0 with PureBasic
If OpenLibrary(0, "pulsar.DLL")
Else
MessageRequester("no se cargo", "carga", 0)
EndIf
;-------------------------------------------------------------------
; Record defined in UDT (User Defined Types) for this demostration.
; This structure is used by RQ_NewConventionalDB packed subroutine
; in the database creation and others functions during the access
; operations into database
Structure Fields
Apellido$
Nombres$
Email$
Web$
EndStructure
DatabaseRecord.Fields ;Database Record used in this program
; ------------------------------------------------------------------
; BEGIN DEMO
; ------------------------------------------------------------------
MessageRequester("BEGIN DEMO: HOW CREATE A NEW DATABASE.", "Púlsar 3.0 in PureBasic", 0)
; 'variables used in this program
PulsarPath$="d:\" ;the database file is saved in this path
PulsarFile$="Conventional_DB" ;database filename
;--------------------------------------------------------------------
;HOW To CREATE A NEW CONVENTIONAL DATABASE?
;
;NewConventionalDB packed subroutine allow create a new database file
;in your disk. Use the Structure$ variable To define the Structure
;coincident with the UDT:
;TYPE Fields
; Apellido AS STRING * 30 'last name field
; Nombres AS STRING * 40 'first name field
; Email AS STRING * 20 'e-mail field
; Web AS STRING * 50 'web field
;End TYPE
;DatabaseRecord variable is used in this program For contain UDT Structure
;
;The IndexField$ variable define the index field For ordering the Data
;into file
Structura$="APELLIDO:30,NOMBRES:40,E-MAIL:20,WEB:50"
IndexField$="APELLIDO"
If CallFunction(0, "NewConventionalDB", 0, Structura$, IndexField$, PulsarPath$, PulsarFile$, 0) = 0 ;If database file is created, the packed sub Return "ok".
;If error occur, function Return error code in string
;format: "ERROR CODE:xxx...." (xxx is error code -see púlsar manual-)
Msg$="OPERATION IS NOT COMPLETED: "
MessageRequester(Msg$, "Púlsar 3.0 in PureBasic", 0)
End ;End program
Else
;database is created
MessageRequester("OPERACION OK.", "Púlsar 3.0 in PureBasic", 0)
EndIf
;------------------------------------------------------------------
MessageRequester("¡THE END!", "Púlsar 3.0 in PureBasic", 0)
;End program
End
