Ole DB Update failing

G

Guest

I have code which creates a DataAdapter, and upddate command etc, and then
finally does and update which fails. The error message which is returned is
"Object Reference not set to an instance of an object."

The update SQL is "Update Leads set Company_Name = ? where LeadId = ?"

If I change it to: "Update Leads set Company_Name = ? where LeadID = 5" no
error is thrown and the record is updated.

The first thought of course is that there is a missing update parameter, but
looking in the debugger shows that there are two update parameters, and that
the second one looks just like it should, including having an appropriate
value.

Yet when the update occurs, the error is thrown. This is the the stack at
the time of the error:

An exception of type System.NullReferenceException occured at 7/4/2005
7:59:13 PM
Message:Object reference not set to an instance of an object.

Method:Int32 Update(System.Data.DataRow[],
System.Data.Common.DataTableMapping)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at Avasoft.Leads.LeadsListingSave(CDataSet oDataSet) in
c:\greg\clients\pwhite\blm non vss\blm00\dataaccess\leads.cs:line 188
at Avasoft.LeadsListingBiz.LeadsListingSave(CDataSet oDataSet) in
c:\greg\clients\pwhite\blm non vss\blm00\business\leadslistingbiz.cs:line 27
at Avasoft.LeadViewForm.button1_Click(Object sender, EventArgs e) in
c:\greg\clients\pwhite\blm non vss\blm00\appmain\leadviewform.cs:line 305
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at Avasoft.AppMain.RunApp() in C:\Greg\Clients\PWhite\BLM non
VSS\BLM00\AppMain\AppMain.cs:line 84
at Avasoft.AppMain.DoApp() in C:\Greg\Clients\PWhite\BLM non
VSS\BLM00\AppMain\AppMain.cs:line 47

Any insight into what is occuring would be greatly appreciated - I have
spent about 10 hours on this to no avail, done a Google search, looked
through help files, refactored etc. Thanks.
 
G

Guest

This was resolved by re-installing the OleDB driver. Makes no sense, but
it's working now.

--
Greg Gum


Greg said:
I have code which creates a DataAdapter, and upddate command etc, and then
finally does and update which fails. The error message which is returned is
"Object Reference not set to an instance of an object."

The update SQL is "Update Leads set Company_Name = ? where LeadId = ?"

If I change it to: "Update Leads set Company_Name = ? where LeadID = 5" no
error is thrown and the record is updated.

The first thought of course is that there is a missing update parameter, but
looking in the debugger shows that there are two update parameters, and that
the second one looks just like it should, including having an appropriate
value.

Yet when the update occurs, the error is thrown. This is the the stack at
the time of the error:

An exception of type System.NullReferenceException occured at 7/4/2005
7:59:13 PM
Message:Object reference not set to an instance of an object.

Method:Int32 Update(System.Data.DataRow[],
System.Data.Common.DataTableMapping)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String
srcTable)
at Avasoft.Leads.LeadsListingSave(CDataSet oDataSet) in
c:\greg\clients\pwhite\blm non vss\blm00\dataaccess\leads.cs:line 188
at Avasoft.LeadsListingBiz.LeadsListingSave(CDataSet oDataSet) in
c:\greg\clients\pwhite\blm non vss\blm00\business\leadslistingbiz.cs:line 27
at Avasoft.LeadViewForm.button1_Click(Object sender, EventArgs e) in
c:\greg\clients\pwhite\blm non vss\blm00\appmain\leadviewform.cs:line 305
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at Avasoft.AppMain.RunApp() in C:\Greg\Clients\PWhite\BLM non
VSS\BLM00\AppMain\AppMain.cs:line 84
at Avasoft.AppMain.DoApp() in C:\Greg\Clients\PWhite\BLM non
VSS\BLM00\AppMain\AppMain.cs:line 47

Any insight into what is occuring would be greatly appreciated - I have
spent about 10 hours on this to no avail, done a Google search, looked
through help files, refactored etc. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top