Your going to love me. Unfortunately this still does not work. (Although to be honest I really thought it would do). Here is the current code.
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strPatNum As String = Request.QueryString("PatNum")
cnBarwickPas.Open()
Dim cmdPatsNextKin As New Odbc.OdbcCommand("SELECT ASSETCOM.MASTER5.MSMROL, ASSETCOM.NEXTKIN.NKMROLL, ASSETCOM.NEXTKIN.NKTITLE, ASSETCOM.NEXTKIN.NKFOREN, ASSETCOM.NEXTKIN.NKSURNM, ASSETCOM.NEXTKIN.NKADDR1, ASSETCOM.NEXTKIN.NKADDR2, ASSETCOM.NEXTKIN.NKADDR3, ASSETCOM.NEXTKIN.NKADDR4, ASSETCOM.NEXTKIN.NKPOST7, ASSETCOM.NEXTKIN.NKPHONE, ASSETCOM.NEXTKIN.NKRELAT FROM ASSETCOM.MASTER5, ASSETCOM.NEXTKIN WHERE ASSETCOM.MASTER5.MSMROL = ASSETCOM.NEXTKIN.NKMROLL AND ASSETCOM.MASTER5.MSMROL =" & strPatNum, cnBarwickPas)
Dim drPatsNextKin As Odbc.OdbcDataReader
drPatsNextKin = cmdPatsNextKin.ExecuteReader()
lblTitleSts.Text = drPatsNextKin.GetString(drPatsNextKin.GetOrdinal("NKTITLE"))
lblTitleSts.DataBind()
drPatsNextKin.Close()
cnBarwickPas.Close()
End Sub
This error I receive is:
Code:
No data exists for the row/column.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: No data exists for the row/column.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: No data exists for the row/column.]
System.Data.Odbc.OdbcDataReader.internalGetString(Int32 i) +425
System.Data.Odbc.OdbcDataReader.GetString(Int32 i) +5
DDHPAS.WebForm7.Page_Load(Object sender, EventArgs e) +170
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
So I thought i would double check in SQL that there is data regarding that PatNum and there is, I also double checked to make sure that strPatNum was receiving the value from the query string request and it is.
As soon as I it tries to process this line "lblTitleSts.Text = drPatsNextKin.GetString(drPatsNextKin.GetOrdinal(" NKTITLE"))" thats when it falls over.
I also tried it with the "rPatsNextKin = cmdPatsNextKin.ExecuteReader(CommandBehavior.Singl eRow)" as well.