VB将ACCESS数据库中记录保存到文本
PrivatecnMyDBAsNewADODB.ConnectionPrivatersMeAsNewADODB.RecordsetPrivatestrSQLAsStrin...
Private cnMyDB As New ADODB.Connection
Private rsMe As New ADODB.Recordset
Private strSQL As String
Private Sub Command1_Click()
Me.CommonDialog1.InitDir = App.Path
Me.CommonDialog1.ShowOpen
strSQL = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CommonDialog1.FileName & ";Persist Security Info=False"
cnMyDB.Open strSQL
strSQL = "Select * From picture"
rsMe.CursorLocation = adUseClient
rsMe.Open strSQL, cnMyDB, adOpenDynamic, adLockOptimistic
Set Me.DataGrid1.DataSource = rsMe
Me.DataGrid1.Refresh
End Sub
这段代码将ACCESS数据库在网格中显示了,如果要将指定行保存到文本,该如何操作啊?
能详细给出代码的朋友我会再加分 展开
Private rsMe As New ADODB.Recordset
Private strSQL As String
Private Sub Command1_Click()
Me.CommonDialog1.InitDir = App.Path
Me.CommonDialog1.ShowOpen
strSQL = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CommonDialog1.FileName & ";Persist Security Info=False"
cnMyDB.Open strSQL
strSQL = "Select * From picture"
rsMe.CursorLocation = adUseClient
rsMe.Open strSQL, cnMyDB, adOpenDynamic, adLockOptimistic
Set Me.DataGrid1.DataSource = rsMe
Me.DataGrid1.Refresh
End Sub
这段代码将ACCESS数据库在网格中显示了,如果要将指定行保存到文本,该如何操作啊?
能详细给出代码的朋友我会再加分 展开
2个回答
展开全部
SELECT 要导出的字段列表 into
[Text;HDR=YES;DATABASE=C:\].a.txt
from 表
--导出EXCEL文件:
SELECT 要导出的字段列表 INTO [Excel 5.0;HDR=YES;IMEX=2;DATABASE=c:\test.xls].sheet1
FROM 表
[Text;HDR=YES;DATABASE=C:\].a.txt
from 表
--导出EXCEL文件:
SELECT 要导出的字段列表 INTO [Excel 5.0;HDR=YES;IMEX=2;DATABASE=c:\test.xls].sheet1
FROM 表
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
rsMe.Open strSQL, cnMyDB, adOpenDynamic, adLockOptimistic
open "d:/1.txt" for Output as #1
do while not rsme.eof
For j = 0 To rsme.Fields.Count - 1
Print rsme(j); "|";
Next j
Print
rsme.movenext
loop
close #1
open "d:/1.txt" for Output as #1
do while not rsme.eof
For j = 0 To rsme.Fields.Count - 1
Print rsme(j); "|";
Next j
rsme.movenext
loop
close #1
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询