Code:
Dim rs As New ADODB.Recordset Dim oCnn As ADODB.Connection Set oCnn = New ADODB.Connection 'Windows Integrated Security Login 'oCnn.ConnectionString = "provider=sqloledb;data source=intel;initial catalog=Northwind;integrated security=sspi;" 'oCnn.Open oCnn.Open "Driver={SQL Server};" & _ "Server=(local);" & _ "Database=Northwind;" & _ "Uid=sa;" & _ "Pwd=sa" Set rs = oCnn.Execute("SELECT * FROM Customers") 'While Not rs.EOF For i = 1 To rs.Fields.Count MsgBox ("current field name = ") & rs.Fields(i).Name Next i MsgBox ("no of fields = ") & i 'Wend
Comment