473,804 Members | 3,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ole DB Update failing

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.NullRefe renceException occured at 7/4/2005
7:59:13 PM
Message:Object reference not set to an instance of an object.

Method:Int32 Update(System.D ata.DataRow[],
System.Data.Com mon.DataTableMa pping)
at System.Data.Com mon.DbDataAdapt er.Update(DataR ow[] dataRows,
DataTableMappin g tableMapping)
at System.Data.Com mon.DbDataAdapt er.Update(DataS et dataSet, String
srcTable)
at Avasoft.Leads.L eadsListingSave (CDataSet oDataSet) in
c:\greg\clients \pwhite\blm non vss\blm00\dataa ccess\leads.cs: line 188
at Avasoft.LeadsLi stingBiz.LeadsL istingSave(CDat aSet oDataSet) in
c:\greg\clients \pwhite\blm non vss\blm00\busin ess\leadslistin gbiz.cs:line 27
at Avasoft.LeadVie wForm.button1_C lick(Object sender, EventArgs e) in
c:\greg\clients \pwhite\blm non vss\blm00\appma in\leadviewform .cs:line 305
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G& msg)
at
System.Windows. Forms.Component Manager.System. Windows.Forms.U nsafeNativeMeth ods+IMsoCompone ntManager.FPush MessageLoop(Int 32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows. Forms.ThreadCon text.RunMessage LoopInner(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.ThreadCon text.RunMessage Loop(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Applicati on.RunDialog(Fo rm form)
at System.Windows. Forms.Form.Show Dialog(IWin32Wi ndow owner)
at System.Windows. Forms.Form.Show Dialog()
at Avasoft.AppMain .RunApp() in C:\Greg\Clients \PWhite\BLM non
VSS\BLM00\AppMa in\AppMain.cs:l ine 84
at Avasoft.AppMain .DoApp() in C:\Greg\Clients \PWhite\BLM non
VSS\BLM00\AppMa in\AppMain.cs:l ine 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
1 1858
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.NullRefe renceException occured at 7/4/2005
7:59:13 PM
Message:Object reference not set to an instance of an object.

Method:Int32 Update(System.D ata.DataRow[],
System.Data.Com mon.DataTableMa pping)
at System.Data.Com mon.DbDataAdapt er.Update(DataR ow[] dataRows,
DataTableMappin g tableMapping)
at System.Data.Com mon.DbDataAdapt er.Update(DataS et dataSet, String
srcTable)
at Avasoft.Leads.L eadsListingSave (CDataSet oDataSet) in
c:\greg\clients \pwhite\blm non vss\blm00\dataa ccess\leads.cs: line 188
at Avasoft.LeadsLi stingBiz.LeadsL istingSave(CDat aSet oDataSet) in
c:\greg\clients \pwhite\blm non vss\blm00\busin ess\leadslistin gbiz.cs:line 27
at Avasoft.LeadVie wForm.button1_C lick(Object sender, EventArgs e) in
c:\greg\clients \pwhite\blm non vss\blm00\appma in\leadviewform .cs:line 305
at System.Windows. Forms.Control.O nClick(EventArg s e)
at System.Windows. Forms.Button.On Click(EventArgs e)
at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
at System.Windows. Forms.Button.Wn dProc(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.OnMe ssage(Message& m)
at System.Windows. Forms.ControlNa tiveWindow.WndP roc(Message& m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G& msg)
at
System.Windows. Forms.Component Manager.System. Windows.Forms.U nsafeNativeMeth ods+IMsoCompone ntManager.FPush MessageLoop(Int 32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows. Forms.ThreadCon text.RunMessage LoopInner(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.ThreadCon text.RunMessage Loop(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Applicati on.RunDialog(Fo rm form)
at System.Windows. Forms.Form.Show Dialog(IWin32Wi ndow owner)
at System.Windows. Forms.Form.Show Dialog()
at Avasoft.AppMain .RunApp() in C:\Greg\Clients \PWhite\BLM non
VSS\BLM00\AppMa in\AppMain.cs:l ine 84
at Avasoft.AppMain .DoApp() in C:\Greg\Clients \PWhite\BLM non
VSS\BLM00\AppMa in\AppMain.cs:l ine 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

198
18412
by: Michael N. Christoff | last post by:
Java, the software developed by Sun Microsystems in the mid-1990s as a universal operating system for Internet applications, gave NASA a low-cost and easy-to-use option for running Spirit, the robotic rover that rolled onto the planet's surface on Thursday in search of signs of water and life. http://news.com.com/2100-1007_3-5142220.html?tag=nefd_top l8r, Mike N. Christoff
16
17026
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then IF FOUND UPDATE <TABLE> SET .... <Values entered here> ELSE INSERT INTO <TABLE> VALUES <Values...
2
2801
by: ksedran | last post by:
I am having a "not all variables bound" issue when trying to delete a row from a datagrid. I have a datagrid populated with data from a oracle table as follows: da = New OracleDataAdapter("SELECT a.inst, a.group, a.privs, b.field FROM table a, table b WHERE....... da.Fill(ds, "TW_GROUP_PRIVS") da.datamember = "TW_GROUP_PRIVS")
18
1883
by: Scott David Daniels | last post by:
There has been a bit of discussion about a way of providing test cases in a test suite that _should_ work but don't. One of the rules has been the test suite should be runnable and silent at every checkin. Recently there was a checkin of a test that _should_ work but doesn't. The discussion got around to means of indicating such tests (because the effort of creating a test should be captured) without disturbing the development flow. ...
0
1192
by: EggNChips | last post by:
Hi, trying to update a BLOB column using SQLParamData / SQLPutData and it all works fine until the BLOB is > ~700KB. I'm putting it in 1KB chunks, but I have also tried 2KB without success. The SQLPutdata succeeds, but when the final SQLParamData is called SQL_ERROR is returned and the log file shows: DIAG Lost connection to MySQL server during query (2013)
0
1257
by: a_rajanikanth | last post by:
Hi, The following is the trigger which is failing when executing. Can you please tell me the reason why it is failing ? Trigger got created but throwing exception. CREATE TRIGGER TOBJ_U AFTER UPDATE ON TABLE1 REFERENCING OLD AS OLD NEW AS NEW
2
1660
by: andy6 | last post by:
I am using the following code and SQL Profiler shows no activity when I step through the .update line. Do you see a syntax error? Thanks! using (SqlConnection cn = new SqlConnection(cnStr)) { SqlCommand updCmd = new SqlCommand ("sp_web_edit_manager_update", cn); SqlDataAdapter adpt = new SqlDataAdapter(updCmd);
2
2633
by: Hexman | last post by:
Hello All, Well I'm stumped once more. Need some help. Writing a simple select and update program using VB.Net 2005 and an Access DB. I'm using parameters in my update statement and when trying to update a record, I get a "No value given for one or more parameters." error message. I use a Select with parameters and an Update with parameters. The select works fine. I thought I've tried everything (evidently not) to get this working. ...
0
9856
NeoPa
by: NeoPa | last post by:
Introduction : I have come across a problem, on a number of occasions, where PCs under my control fail to load new updates successfully. This is true whether they are attempting to apply via the Automatic Updates facility built into the OS or whether accessing the MS Update site directly. Reason : The problem is often associated with DLL files not being correctly set up for some reason. Most of the suggested fixes involve registering a...
0
9711
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9591
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10594
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.