Private Sub CommandButton1_Click()

Set con = CreateObject("adodb.connection")
Set rs = CreateObject("adodb.recordset")
con.Open "Provider=sqloledb; Data Source=db-serv;Initial Catalog=test; User Id=admin; Password=admin;"
rs.Open "select *from test2", con
i = 2
Do While Not rs.EOF
Cells(i, 2) = rs("categorie")
rs.movenext
i = i + 1
Loop
rs.Close
Set rs = Nothing
Set con = Nothing

End Sub

VN:F [1.1.6_502]
Rating: 5.0/5 (2 votes cast)
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati

Related posts:

  1. Connect using UDL file from .NET
  2. SQL Server CURSOR - loop through records
  3. Connect to Microsoft SQL Server from Java
  4. Build DateTime from values
  5. Return multiple values from a function