C
Chuck Hecht
I am getting the "NullReferenceException" error on this line
foundRow = dsScannerdata.Tables("dtReceivePdai").Rows.Find(mykey)
in the following code.
All of the values in the mykey field are unique and there are not blank
records
Any help is appreicated!!!!!!!
*******code to find the record in the table********
Dim mykey As String = gMykey.ToString
Dim foundRow As DataRow
foundRow = dsScannerdata.Tables("dtReceivePdai").Rows.Find(mykey)
If foundRow IsNot Nothing Then
MsgBox(foundRow(1).ToString())
Else
MsgBox("A row with the primary key of " & mykey & " could not be found")
End If
mykey is the primary key in the table receivepdai
*******code for primary key field********
Dim dcmykey(1) As DataColumn
dcmykey(0) = New DataColumn("mykey", System.Type.GetType("System.String"))
dtReceivePdai.Columns.Add(dcmykey(0))
dtReceivePdai.PrimaryKey = dcmykey
foundRow = dsScannerdata.Tables("dtReceivePdai").Rows.Find(mykey)
in the following code.
All of the values in the mykey field are unique and there are not blank
records
Any help is appreicated!!!!!!!
*******code to find the record in the table********
Dim mykey As String = gMykey.ToString
Dim foundRow As DataRow
foundRow = dsScannerdata.Tables("dtReceivePdai").Rows.Find(mykey)
If foundRow IsNot Nothing Then
MsgBox(foundRow(1).ToString())
Else
MsgBox("A row with the primary key of " & mykey & " could not be found")
End If
mykey is the primary key in the table receivepdai
*******code for primary key field********
Dim dcmykey(1) As DataColumn
dcmykey(0) = New DataColumn("mykey", System.Type.GetType("System.String"))
dtReceivePdai.Columns.Add(dcmykey(0))
dtReceivePdai.PrimaryKey = dcmykey