query sql database for specific value in vb.net
- by user2952298
I am trying to convert VBA code to vb.net, im having trouble trying to search the database for a specific value around an if statement. any suggestions would be greatly appriciated.
thedatabase is called confirmation, type  is the column and email is the value im looking for. could datasets work?
Function SendEmails() As Boolean
    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim objOutlookRecip As Outlook.Recipient
    Dim objOutlookAttach As Outlook.Attachment
    Dim intResponse As Integer
    Dim confirmation As New ADODB.Recordset
    Dim details As New ADODB.Recordset
    On Error GoTo Err_Execute
    Dim MyConnObj As New ADODB.Connection
    Dim cn As New ADODB.Connection()
    MyConnObj.Open( _
             "Provider = sqloledb;" & _
             "Server=myserver;" & _
             "Database=Email_Text;" & _
             "User Id=bla;" & _
             "Password=bla;")
    confirmation.Open("Confirmation_list", MyConnObj)
    details.Open("MessagesToSend", MyConnObj)
    If details.EOF = False Then
      confirmation.MoveFirst()
      Do While Not confirmation.EOF
          If confirmation![Type] = "Email" Then 
             ' Create the Outlook session.
              objOutlook = CreateObject("Outlook.Application")
             ' Create the message.
    End IF