locked
Declaring and setting value RRS feed

  • Question

  • User-749682434 posted

    Can someone please help me with my VB.NET mental block? Between lines 12 and 13 I need to decalre OrgName and give it the value from the SELECT Statement. Any help greatly appreciated. Thanks

    1            Dim strConn As String = "MyConnecitonGoesHere"
    2    
    3            MySQL = "SELECT dbo.vwStateFacilitiesForAssessment.OrgName FROM dbo.vwStateFacilitiesForAssessment INNER JOIN pmc.ProgramManagementPrep ON dbo.vwStateFacilitiesForAssessment.DVN = pmc.ProgramManagementPrep.DVN WHERE pmc.ProgramManagementPrep.isActive = 1 AND pmc.ProgramManagementPrep.DVN= ?"
    4    
    5            Dim MyConn As New OleDbConnection(strConn)
    6            Dim objDR As OleDbDataReader
    7            Dim Cmd As New OleDbCommand(MySQL, MyConn)
    8            Cmd.Parameters.AddWithValue("@DVN", DVN)
    9            Try
    10               MyConn.Open()
    11               objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
    12               If objDR.HasRows Then
    13               Else
    14                   Response.Redirect("/Extras/NoProgram.aspx")
    15               End If
    16           Finally
    17               MyConn.Close()
    18           End Try
    
     
    Friday, October 24, 2008 11:14 AM

Answers

  • User-990694832 posted

    objdr.read() 

    If objDR.HasRows Then

          your value =objDR("OrgName")
    Else

        redirect...

    end if

     

     

    hope this helps

    DK

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 24, 2008 11:46 AM

All replies

  • User-990694832 posted

    objdr.read() 

    If objDR.HasRows Then

          your value =objDR("OrgName")
    Else

        redirect...

    end if

     

     

    hope this helps

    DK

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 24, 2008 11:46 AM
  • User-749682434 posted

    Thanks

    Friday, October 24, 2008 4:32 PM
  • User-832781527 posted

     exactly,

    Sunday, October 26, 2008 1:27 PM