by Chinmaya Kumar Mishra (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 25th June 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Convet Database Table To Textfiles And Read The text File In The Programme. Contract : Chinmaya Kumar Mishra.Bhubaneswar,Orissa,INDIA
API Declarations
'Named it as student and store it in "C:\" As "c:\student.mdb"
'Make Two Fields Name As Fieldname NAME,Datatype TEXT,Size=25
'Another One Mark As Fieldname Mark,Datatype TEXT,Size=10
'Then Open VB & put Two command buttons on the form
'If Any Error Occur Plz E-Mail me for personnel Help
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
On Error GoTo erra
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\student.mdb;Persist Security Info=False"
rs.Open "select * from student_details", cn, 3, 1
Open "C:\student_details.txt" For Output As #1
If rs.RecordCount = 0 Then
MsgBox "No Data Found"
Exit Sub
End If
Do Until rs.EOF
l = 25 - Len(rs(0))
str1 = IIf(IsNull(rs(0)), "", rs(0)) + Space(l) + Chr(9) + IIf(IsNull(rs(1)), "", rs(1)) + Chr(13)
Print #1, str1
rs.MoveNext
Loop
MsgBox CStr(rs.RecordCount) + " -> Records Successfully Converted"
Close #1
rs.Close
cn.Close
Exit Sub
erra:
MsgBox "Error :" + Err.Description
End Sub
Private Sub Command2_Click()
On Error GoTo err1
Shell "notepad " + "C:\student_details.txt", vbMaximizedFocus
Exit Sub
err1:
MsgBox "Error : " + Err.Description
End Sub
No comments have been posted about Convet Database Table To Textfiles And Read The text File In The Programme. Contract : Chinmaya Kum. Why not be the first to post a comment about Convet Database Table To Textfiles And Read The text File In The Programme. Contract : Chinmaya Kum.