0% found this document useful (0 votes)
2 views

Ado

The document contains Visual Basic code snippets for handling data from a database using ADODC and displaying it in a ListView. It includes functions for filtering records by date, calculating totals from a data grid, and populating a ListView with database records. Additionally, it features error handling and data retrieval processes.

Uploaded by

nassar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Ado

The document contains Visual Basic code snippets for handling data from a database using ADODC and displaying it in a ListView. It includes functions for filtering records by date, calculating totals from a data grid, and populating a ListView with database records. Additionally, it features error handling and data retrieval processes.

Uploaded by

nassar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Dim stdate As String

Dim edate As String

Adodc1.RecordSource = "SELECT * FROM StockRun WHERE format(SDate,'MM') Between '" &


Format(DTPicker1.Value, "MM") & "' And '" & Format(DTPicker2.Value, "MM") & "'"
Adodc1.Refresh
Text1.Text = Adodc1.RecordSource
end sub

-------
, 11:15 AM
��� ����� ��� �������� �� ���� ���� adodc

Adodc1.Recordset.Filter = " date >= #" & text1.text & "# and date <= #" &
text2.text & "# "

------------------
Private Sub Get_dblSum()
Dim dblSum As Double

Me.Adodc1.Recordset.MoveFirst
Do While Not Me.Adodc1.Recordset.EOF
dblSum = dblSum + Me.Adodc1.Recordset.Fields(2)
Me.Adodc1.Recordset.MoveNext
Loop
MsgBox "Total: " & dblSum

Me.Adodc1.Recordset.MoveFirst
End Sub
------------
Dim i As Integer
Dim sum As Double
For i = 0 To RS.RecordCount - 1
sum= sum + CDbl(DataGrid1.Columns(1).Text)
RS.MoveNext
Next i
Label1.Caption = sum
----------
list view
--
Private Sub Get_Col_Total()
Dim L_Index As Long
Dim Total_Sum As Long

For L_Index = 1 To ListView1.ListItems.Count


Total_Sum = Total_Sum + ListView1.ListItems(L_Index).SubItems(1)
Next

Label_Total = Total_Sum
End Sub
������ : .SubItems(1) �� ��� ������ ������ ����� ������� ��� - ����� ������ ���
��� ������ �������
------------------*-
Private Sub Data_Get()
On Error Resume Next ': Err.Clear
Adodc1.CommandType = adCmdText
Adodc1.Refres

Dim XItem As ListItem


ListView1.ListItems.Clear

Do While Not Adodc1.Recordset.EOF


Set XItem = ListView1.ListItems.Add(, , Adodc1.Recordset(0) & vbNullString)
XItem.SubItems(1) = Adodc1.Recordset(1) & vbNullString
XItem.SubItems(2) = Adodc1.Recordset(2) & vbNullString
XItem.SubItems(3) = Adodc1.Recordset(3) & vbNullString
XItem.SubItems(4) = Adodc1.Recordset(4) & vbNullString
XItem.SubItems(5) = Adodc1.Recordset(5) & vbNullString
XItem.SubItems(6) = Adodc1.Recordset(6) & vbNullString
Adodc1.Recordset.MoveNext
Loop

Call Get_Col_Total
End Sub

You might also like