文件名称:VB 与SQL连接源程式
文件大小:2KB
文件格式:ZIP
更新时间:2017-10-15 04:46:21
VB 连接SQL
Private Function Selectsql(SQL As String) As ADODB.Recordset '返回ADODB.Recordset对象 Dim ConnStr As String Dim Conn As ADODB.Connection Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset Set Conn = New ADODB.Connection 'On Error GoTo MyErr: ConnStr = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Password=sa;Initial Catalog=data;Data Source=127.0.0.1" '这是连接SQL数据库的语句 Conn.Open ConnStr rs.CursorLocation = adUseClient rs.Open Trim$(SQL), Conn, adOpenDynamic, adLockOptimistic Set Selectsql = rs 'Exit Function
【文件预览】:
VB 与SQL连接源码
----工程1.vbw(52B)
----MSSCCPRJ.SCC(190B)
----Form1.frm(3KB)
----工程1.vbp(729B)