VB连接SQL数据库示例 建一个工程,建立一个form1,form1中的代码如下: Dim rsNew As ADODB.Recordset Dim CnNew As ADODB.Connection Dim wsh As New WshShell Dim serverlink As String Private Sub Command1_Click()
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