• Welcome to SQLitening Support Forum.


Welcome to the SQLitening support forums!

Main Menu

Introduce SQLitening to Chinese Developer

Started by cyberazor, March 10, 2014, 05:52:28 AM

Previous topic - Next topic


For rarely introductions and documents are written in Chinese, I want to post some articles on my Chinese blog for such a nice project, with some .Net examples and attentions for non-English user.

So am I permitted to show and analyse the source code of SQLitening by reference?


'  ====================================================================
'  |                                                                |
'  | SQLitening Include                                 
'  |                                                               
'  ====================================================================
'   This include file is intended to be used by PowerBASIC programs
'   that use the SQLitening.Dll (also any other language that fully
'   supports OLE string parameter passing). See SQLitening.Txt or
'   SQLitening.Chm for information on each command.
'  ====================================================================
'  The author or authors of this code dedicate any and all
'  copyright interest in this code to the public domain.
'  Anyone is free to copy, modify, publish, use, compile,
'  sell, or distribute the original code, either in source
'  code form or as a compiled binary, for any purpose,
'  commercial or non-commercial, and by any means.
'  Fred Meier - July 2012   

From me:
If looking for an excellent grid see http://www.grid2000.com
It works great with PowerBASIC and VB6 and VB.NET.
The demos come with VB source and I have worked with them for years.

Flexcell comes from China and has excellent support by Michael Chen.
The ActiveX version is $129
The .NET version is $159.

I have no relationship to the company. It is a great value and can make
working with SQLitening and VB very easy and enjoyable!
"No email alerts being received"  Please often check back.

Jean-Pierre LEROY


QuoteIt works great with PowerBASIC and VB6 and VB.NET.

Can you share with us sample code how to use FlexCell with PowerBASIC ?



This would use VB6.

To use with PowerBASIC compile PowerBASIC routines into a DLL and EXPORT them.
The PowerBASIC DLL could send to clipboard, file or return as a string or array.

'1 Add module SQLiteningVB.inc
'2 Add FlexCell component to form1
'3 Add Command button to form1
Option Explicit
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Const ConnectRemote = 0 ' 0=local, others = remote
Const DropTableAndIndex = 1
Const IpAddress = ""
Const PortNumber = 51234
Dim gConnected As Long
Private Sub Command1_Click()
End Sub
Private Sub Form_Load()
  Dim result As Long
  ChDir App.Path
  slSetProcessModsVB "E2" 'end on error if cancel clicked
  If ConnectRemote Then
    If slConnectVB(IpAddress, PortNumber) Then 'error if not 0
      gConnected = 1
      Sleep 250 'may prevent lock-up
    End If
  End If
  Command1.Caption = "Insert 2"
  With Grid1  'some optional grid settings
    .Move 0, 0, ScaleWidth, ScaleHeight
    .DisplayRowIndex = False
    .Column(0).Width = 0
    .AllowUserSort = True
    .DisplayFocusRect = False
    .SortIndicatorColor = vbRed
    .SelectionMode = cellSelectionNone
    '.ExtendLastCol = False
  End With
  Command1.Visible = True
  slOpenVB "database.db3", "C"
  If DropTableAndIndex Then
    slExeVB "drop table if exists clients"
    slExeVB "drop index if exists Index1"
  End If
  slExeVB "Create Table If Not Exists Clients(ClientID integer primary key,LastName,FirstName)"
  slExeVB "Create Index if Not Exists Index1 On Clients(LastName,FirstName)"

End Sub
Function Test()
  Grid1.Visible = True
  Dim Row As Long, col As Long, cols As Long, result As Long, s As String
  s = s + "BEGIN IMMEDIATE;"
  s = s + "Insert into Clients values(NULL,'SIMPSON','HOMER');"
  s = s + "Insert into Clients values(NULL,'SIMPSON','BART');"
  s = s + "END"
  slExeVB s
  slSelVB "Select * FROM Clients order by LastName"
  cols = slGetColumnCountVB
  If cols = 0 Then GoTo Disconnect
  With Grid1
    .Rows = 1            'clear previous grid
    .AutoRedraw = False
    .cols = cols + 1     'account for flexcell index column
    .Rows = 50001        'decrease after select statement
  End With
  Row = 0 'header row
  For col = 1 To cols   '  column loop
    Grid1.Cell(0, col).Alignment = cellLeftCenter
    Grid1.Cell(Row, col).Text = slGetColumnNameVB(col)
  Next                                           '  loop
  Do While slGetRowVB  'put data into grid
    Row = Row + 1
    For col = 1 To cols
      Grid1.Cell(Row, col).Text = slFVB(col)
  If ConnectRemote Then
    Me.Caption = IpAddress + "  Rows" + Str$(Row)
    Me.Caption = "Local mode Rows" + Str$(Row)
  End If
  With Grid1
    .Rows = Row + 1    'set rows to what is actually needed
    .AutoRedraw = True 'turn redraw back on
    .Refresh           'show data
  End With
Exit Function
  MsgBox slGetErrorVB
End Function
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  If gConnected Then
    gConnected = 0
    Sleep 250 'may prevent lock-up
  End If
End Sub
Private Sub Form_Resize()
  Grid1.Move 0, 0, ScaleWidth, ScaleHeight
  Command1.Move ScaleWidth - Command1.Width, 0
End Sub
"No email alerts being received"  Please often check back.