Hi everybody
Follow the curse of my report aplication, i can join two datasets but
vb .net send me a message error: "An unhandled exception of type "System.NullReferenceException" ocurred in RECON REPORT.exe. Aditional Information: Object reference not set an instance of an object".
I glad you help.
It is my code:
xlsel = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Proyecto RECON Report\v0.1\RECON REPORT\recon_db.mdb"
Try
'Open connection
bdconnection = New OleDbConnection(xlsel)
bdconnection.Open()
Catch ex As Exception
MsgBox(" Error openning the connection :" & vbCrLf & ex.Message)
Labled.Text = "Error"
Exit Sub
End Try
ds2excel = New Data.DataSet
xlsel = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Proyecto RECON Report\v0.1\RECON REPORT\recon_db.mdb"
Try
'Open connection
bdconnection = New OleDbConnection(xlsel)
bdconnection.Open()
Catch ex As Exception
MsgBox(" Error openning the connection :" & vbCrLf & ex.Message)
Exit Sub
End Try
'master part_numbs
xsqlmst = "SELECT masters.[Part Number] " & _
"FROM masters;"
'ercw data
'ercw Def_Shipments
xsql = "SELECT ercw.PARTNUMBER, Count([ercw.OUTCOME_CODE]) AS Def_Shipments " & _
"FROM ercw " & _
"GROUP BY ercw.PARTNUMBER, ercw.OUTCOME_CODE " & _
"HAVING (((ercw.OUTCOME_CODE)= 'IW'))" & _
"ORDER BY ercw.PARTNUMBER, ercw.OUTCOME_CODE;"
'ercw IW
xsql2 = "SELECT ercw.PARTNUMBER, Count([ercw.OUTCOME_CODE]) AS MECH " & _
"FROM ercw " & _
"GROUP BY ercw.PARTNUMBER, ercw.OUTCOME_CODE " & _
"HAVING (((ercw.OUTCOME_CODE)='IW' Or (ercw.OUTCOME_CODE)='IW_SGT'))" & _
"ORDER BY ercw.PARTNUMBER, ercw.OUTCOME_CODE;"
bdmstadapter = New OleDbDataAdapter(xsqlmst, bdconnection)
bdadapter = New OleDbDataAdapter(xsql, bdconnection)
Try
bdmstadapter.Fill(dsmasters)
bdmstadapter.Dispose()
bdadapter.Fill(dsDefShip)
bdadapter.Dispose()
bdconnection.Close()
Catch ex As Exception
MessageBox.Show("Error charging the dataset: " & vbCrLf & ex.Message)
End Try
'Fill the dataset
Dim ds2row As DataRow
ds2excel.Tables.Add("RECON_REPORT")
ds2excel.Tables("RECON_REPORT").Columns.Add("PARTN UMBER")
ds2excel.Tables("RECON_REPORT").Columns.Add("DEF_S HIPMENTS")
For Counter = 0 To ds2excel.Tables("RECON_REPORT").Rows.Count
ds2row = ds2excel.Tables("RECON_REPORT").NewRow()
'here marks my error

ds2row.Item("PARTNUMBER") = dsmasters.Tables("MASTERS").Rows(Counter).Item(0). ToString()
ds2excel.Tables("RECON_REPORT").Rows.Add(ds2row)
Next Counter