By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,126 Members | 1,210 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,126 IT Pros & Developers. It's quick & easy.

Ole DB Update failing

P: n/a
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(MouseEventAr gs 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(M essage& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windo ws.Forms.UnsafeNativeMethods+IMsoComponentManager. FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopI nner(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.

--
Greg Gum
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


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

--
Greg Gum
"Greg" wrote:
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(MouseEventAr gs 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(M essage& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at
System.Windows.Forms.ComponentManager.System.Windo ws.Forms.UnsafeNativeMethods+IMsoComponentManager. FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopI nner(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.

--
Greg Gum

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.