J
Joe Coder
Hi All,
I am trying to add a new row to an existing table in my database. I
get the error "An unhandled exception of type
'System.NullReferenceException' occurred in OracleConnectionTest.exe
Additional information: Object reference not set to an instance of an
object." when I try to define a new row.
I have been able to add a new row in MSDE but when I try to adapt my
sub to Oracle it bombs at "myDataRow = ds.Tables(BayID).NewRow()".
Any help will be appreciated.
Thanks,
Here is my code:
Sub UseDataSet(ByVal BayID As String)
BayID = "Template"
Dim ds As New DataSet
Dim da As New OracleDataAdapter("select * from BAY_" & BayID,
"data source=WAREHOUSE;" & _
"user id=ODBCUSER;password=MAYFLOWER")
Dim bld As New OracleCommandBuilder(da)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(ds, "BAY_" & BayID)
Dim myDataRow As DataRow
myDataRow = ds.Tables(BayID).NewRow()
myDataRow("REC_NUM") = 256
myDataRow("PALETTEID") = "110203005"
myDataRow("RUNDATE") = "11/2/2003"
ds.Tables(BayID).Rows.Add(myDataRow)
da.Update(ds, "BAY_" & BayID)
End Sub
I am trying to add a new row to an existing table in my database. I
get the error "An unhandled exception of type
'System.NullReferenceException' occurred in OracleConnectionTest.exe
Additional information: Object reference not set to an instance of an
object." when I try to define a new row.
I have been able to add a new row in MSDE but when I try to adapt my
sub to Oracle it bombs at "myDataRow = ds.Tables(BayID).NewRow()".
Any help will be appreciated.
Thanks,
Here is my code:
Sub UseDataSet(ByVal BayID As String)
BayID = "Template"
Dim ds As New DataSet
Dim da As New OracleDataAdapter("select * from BAY_" & BayID,
"data source=WAREHOUSE;" & _
"user id=ODBCUSER;password=MAYFLOWER")
Dim bld As New OracleCommandBuilder(da)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(ds, "BAY_" & BayID)
Dim myDataRow As DataRow
myDataRow = ds.Tables(BayID).NewRow()
myDataRow("REC_NUM") = 256
myDataRow("PALETTEID") = "110203005"
myDataRow("RUNDATE") = "11/2/2003"
ds.Tables(BayID).Rows.Add(myDataRow)
da.Update(ds, "BAY_" & BayID)
End Sub