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 Try10 MyConn.Open()
11 objDR = Cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
12 If objDR.HasRows Then
13 Else14 Response.Redirect("/Extras/NoProgram.aspx")
15 End If
16 Finally17 MyConn.Close()
18 End Try