Using SQL-SELECT to fetch Tally data from Visual Basic
RTSlink DLL v1.8 (or higher) comes with a new function named SQLRequest() that allows
you to use SQL-SELECT statement to fetch Tally Software data.
Here's a sample program illustrating the use of the SQLRequest() function.
Visual Basic Code:-
|
Option Explicit
Declare Function RTSOpen Lib "RTSLINK.DLL" Alias
"Open" () As Long
Declare Function GetLastErrorMessage Lib "RTSLINK.DLL"
() As String
Declare Function ResponseText Lib "RTSLINK.DLL"
() As String
Declare Function SQLRequest Lib "RTSLINK.DLL"
(ByVal SQL As String) As Long
Public Sub vbSend()
Dim nResult As Integer
Dim strErrorMsg As String * 255
'Connect to Tally server using RTSOpen().
On success, Zero is returned.
nResult = RTSOpen()
If nResult = 0 Then
nResult = SQLRequest("Select
$Name,$ClosingBalance from Ledger where $$IsBelongsTo:$$GroupSundryDebtors")
If nResult = 0 Then
'TO DO - Code
to process the data retreived from Tally.
MsgBox ResponseText()
Else
strErrorMsg =
GetLastErrorMessage()
MsgBox "Error: " & strErrorMsg
End If
Else
'If Tally software is NOT
running
strErrorMsg = GetLastErrorMessage()
MsgBox "Error: " & strErrorMsg
End If
End Sub
|
|