Summary: VB6.0
The following is the connection database string of vb6.0
Dim MyDB As New ADODB .Connection
‘Set MyDB as a new ADODB Connection object
Dim MyRec As New ADODB.Recordset
‘Set MyRec as a new ADODB Recordset Object
Private Sub Command1_Click()
Adodc1.ConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:db2.mdb;Persist Security Info =False”
Adodc1.CommandType = adCmdText’<--specified as SQL process
SQL = “Select * From man where employee number=’1′”
< h3>‘The initial statement is SQL = “Select * From File”
Adodc1.RecordSource = SQL
Adodc1.Refresh’<--Refresh
DataGrid1.Refresh’<--Only show the matching data
End Sub
Private Sub Command2_Click()
‘ Related insdelupsata
Dim Cn As Object
Dim Eff As Long
Set Cn = CreateObject(“ADODB.Connection”)
Cn .Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:db2.mdb;Persist Security Info=False”
Cn.Execute “DELETE FROM man WHERE Employee Number = ‘4’ “, Eff
‘Cn.Execute “INSERT INTO man(Employee Number, Name, First Name) VALUES() “, Eff
‘Cn.Execute “DELETE FROM man WHERE Employee Number = ‘4’ “, Eff
MsgBox “Deleted” & Eff & “Pen Data”
End Sub
< /h3>
Private Sub Command3_Click()
Text1.Text = Adodc1.Recordset(“Employee Number”)
Text2.Text = Adodc1.Recordset(“name”)
‘
End Sub
Private Sub Command4_Click()
Adodc1.Recordset.Find “Employee Number = ‘5’”
‘String function http://yuan.yocjh.kh.edu.tw/%E6%95%99%E6%9D%90/vb%E5%87% BD%E6%95%B8.htm
End Sub
Private Sub Command5_Click()
MyDB.Open “Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:db2.mdb”
‘”Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:db2.mdb”
‘The line above was copied using ADODC
‘Use Microsoft.Jet.OLEDB.3.51 Provider < /h3>
‘Load the database into MyDB this ADODB.Connection
‘Want to open Acce For mdb files of ss2000 and Access2003, the above should be changed to: Provider=Microsoft.Jet.OLEDB.4.0;
MyRec.Open “man”, MyDB
‘MyRec select to open MyDB The “VB website” in the data table
‘MyRec At this time, MyRec is filled with data from the VB website of url.mdb
Do Until MyRec.EOF
‘MyRec h3>
List1.AddItem MyRec.Fields(0) & Chr(9) & MyRec.Fields(1) & MyRec.Fields(2)
‘MyRec.Fields(0) means MyRec The data in the first column where the pointer is
‘MyRec.Fields(1) means the data in the second column where the MyRec pointer is
‘Chr(9) then It is a tab character
MyRec.MoveNext
‘The pointer in MyRec moves to the next position
Loop
‘ If the pointer of MyRec has moved to the last one, then this cycle is ended
End Sub
‘Load the database into MyDB this ADODB.Connection
‘Want to open Acce For mdb files of ss2000 and Access2003, the above should be changed to: Provider=Microsoft.Jet.OLEDB.4.0;
MyRec.Open “man”, MyDB
‘MyRec select to open MyDB The “VB website” in the data table
‘MyRec At this time, MyRec is filled with data from the VB website of url.mdb
Do Until MyRec.EOF
‘MyRec h3>
List1.AddItem MyRec.Fields(0) & Chr(9) & MyRec.Fields(1) & MyRec.Fields(2)
‘MyRec.Fields(0) means MyRec The data in the first column where the pointer is
‘MyRec.Fields(1) means the data in the second column where the MyRec pointer is
‘Chr(9) then It is a tab character
MyRec.MoveNext
‘The pointer in MyRec moves to the next position
Loop
‘ If the pointer of MyRec has moved to the last one, then this cycle is ended
End Sub
Original: Large column VB6.0