query sql database for specific value in vb.net

Posted by user2952298 on Stack Overflow See other posts from Stack Overflow or by user2952298
Published on 2013-11-04T11:24:56Z Indexed on 2013/11/04 15:54 UTC
Read the original article Hit count: 197

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about sql

Related posts about vb.net