Function DoSearchAllEntity (Typeid As Integer, sDB As String) As Integer
Dim sData$
Dim Ret%
Dim s1$
Dim s2$
Dim i%
Dim j%
Dim k%
Ret = DoGrid(GridList, 100)
Ret = DoClearAll(0)
LabMsg(0).ForeColor = 0
LabMsg(0).Caption = ""
LabMsg(1).ForeColor = 0
LabMsg(1).Caption = ""
s1 = TxR(0).Text
s2 = TxR(1).Text
PicBtn(7).Visible = False
i = 1
If sDB <> "NULL" And sDB <> "" Then
sData = "SELECT RaisonSociale, Name, prenom, adresse, cp, ville,CodeClient "
sData = sData + " FROM " + sDB + ".dbo.Client WHERE CodeClient.xxKey != 0"
sData = sData + " AND type.integer = " + CStr(Typeid)
If s1 <> "" Then
sData = sData + " AND RaisonSociale Like '*" + s1 + "*' "
End If
If s2 <> "" Then
sData = sData + " AND numcompta Like '*" + s2 + "*' "
End If
Ret = pTmpExecute(sData)
If Ret = True Then
While (Ret = True)
GridList.Row = i
For j = 0 To 6
GridList.Col = j + 1
GridList.Text = pTmpGetItem(j)
Next j
GridList.Col = j + 1
GridList.Text = sDB
i = i + 1
If i > MaxGridRow Then
MaxGridRow = i
GridList.Rows = i
Exit Function
End If
If i > 2 Then
Cel(2).Visible = False
Cel(1).Visible = True
End If
Ret = pTmpMoveNext(0)
Wend
MaxRow = i
GridList.Rows = i
End If
End If
If i = 1 Then
LabMsg(0).Caption = "Aucune Entité ne correspond à votre recherche ..."
LabMsg(1).Caption = "Aucune Entité ne correspond à votre recherche ..."
LabMsg(0).ForeColor = 255
LabMsg(1).ForeColor = 255
End If
End Function
|