3个回答
2014-01-03
展开全部
Public con As ADODB.Connection, Str As String, Ado As ADODB.Recordset, sql As String
Public i As Integer, conn As String
Public Sub ado_Open()
Set con = New ADODB.Connection
conn = "Access"
If conn = "SQL" Then Str = "Driver={SQL SERVER};SERVER=192.168.1.168;Uid=SA;Pwd=;Database=tempdb"
If conn = "Access" Then Str = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "\Finance.mdb;pwd=;ReadOnly=True"
con.Open Str
End Sub
Public Sub Newado()
Set ado = New ADODB.Recordset
ado.CursorLocation = adUseClient
ado.Open sql, con, adOpenDynamic, adLockBatchOptimistic
End Sub
Private Sub CommandButton1_Click()'读取数据库的数据
ado_open
sql="select * from tmp"
newado
text1=Ado.Fields(0)
End Sub
Private Sub CommandButton1_Click()'保存数据
Ado.Fields(0) = text1
Ado.UpdateBatch
End Sub
Public i As Integer, conn As String
Public Sub ado_Open()
Set con = New ADODB.Connection
conn = "Access"
If conn = "SQL" Then Str = "Driver={SQL SERVER};SERVER=192.168.1.168;Uid=SA;Pwd=;Database=tempdb"
If conn = "Access" Then Str = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "\Finance.mdb;pwd=;ReadOnly=True"
con.Open Str
End Sub
Public Sub Newado()
Set ado = New ADODB.Recordset
ado.CursorLocation = adUseClient
ado.Open sql, con, adOpenDynamic, adLockBatchOptimistic
End Sub
Private Sub CommandButton1_Click()'读取数据库的数据
ado_open
sql="select * from tmp"
newado
text1=Ado.Fields(0)
End Sub
Private Sub CommandButton1_Click()'保存数据
Ado.Fields(0) = text1
Ado.UpdateBatch
End Sub
2014-01-03
展开全部
是写入还是输出?
用别的控件绑定数据
然后再通过文本框读取
用别的控件绑定数据
然后再通过文本框读取
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-01-03
展开全部
文本框只是一种数据的输入方式,跟连接数据库没什么关系
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询