This code works fine in VB6 to populate a few combo boxes from a couple of fields in a db. What is the equivalent of this in .NET?
VB Code:
  1. Private Sub Form_Load()
  2. Dim cn As ADODB.Connection
  3. Dim rs As ADODB.Recordset
  4.  
  5.     Set cn = New ADODB.Connection
  6.     cn.ConnectionString = "Provider=SQLOLEDB.1;....." '<-- Full connection string
  7.     cn.Open
  8.    
  9.     Set rs = New ADODB.Recordset
  10.     With rs
  11.         .ActiveConnection = cn
  12.         .CursorLocation = adUseServer
  13.         .CursorType = adOpenForwardOnly
  14.         .LockType = adLockReadOnly
  15.         .Source = "SELECT DISTINCT Titles, Authors From Books"
  16.         .Open
  17.     End With
  18.    
  19.     Do While Not rs.EOF
  20.         cboTitles.AddItem rs!Titles & ""
  21.         cboAuthors.AddItem rs!Authors & ""
  22.         rs.MoveNext
  23.     Loop
  24.    
  25.     rs.Close
  26.     Set rs = Nothing
  27.    
  28.     cn.Close
  29.     Set cn = Nothing
  30. End Sub