473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

updating database with dataset

Good afternoon,

I have a function in a remote server which receives a dataset and makes (or
at least should do) necessary updates. However, Im receiving this error
message in my client browser interface:

"Object Reference not defined for an instance of an object.

Details of execution: System.NullReferenceException: Object Reference not
defined for an instance of an object."

My function is only this:
public bool UpdateDataSet (DataSet DS)

{

OracleDataAdapter adapter;

adapter.Update(DS);

return true;

}

So, any good soul could help me to update a data base using a daaset with
functions update from OracleDataAdapter ? I aprecciate very much your
atention.

Fernanda Menks
Nov 15 '05 #1
2 1487
Fernanda:

You don't have an active instance of the dataadapter...you have it declared
but never initialized.

In order for it to work, you need to have it scoped so that it can be seen
from the call to update.

So on form load you may have adapter.Fill(DS)

But you probably want to declare it at the module level, and perhaps
instantiate it at form load before calling fill.

The way you are doing it, that DataAdapter hasn't been instantiated and as
such, there's no select/update or anything else associated with it so even
if you changed it to OracleDataAdapter adapter = new OracleDataAdapter();

it still wouldn't work.

If you have a DataAdapter control, then just reference
this.AdapterName.UPdate(DS).

HTH,

Bill
"Fernanda" <fe******@luz-ef.com> wrote in message
news:OK**************@TK2MSFTNGP12.phx.gbl...
Good afternoon,

I have a function in a remote server which receives a dataset and makes (or at least should do) necessary updates. However, Im receiving this error
message in my client browser interface:

"Object Reference not defined for an instance of an object.

Details of execution: System.NullReferenceException: Object Reference not
defined for an instance of an object."

My function is only this:
public bool UpdateDataSet (DataSet DS)

{

OracleDataAdapter adapter;

adapter.Update(DS);

return true;

}

So, any good soul could help me to update a data base using a daaset with
functions update from OracleDataAdapter ? I aprecciate very much your
atention.

Fernanda Menks

Nov 15 '05 #2
Fernanda,

The reason it does not work is because the adapter variable is null, as
it is not assigned to, only declared. Basically, you should create an
instance of the OracleDataAdapter and then configure it. After that is
done, then you can call the Update method.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Fernanda" <fe******@luz-ef.com> wrote in message
news:OK**************@TK2MSFTNGP12.phx.gbl...
Good afternoon,

I have a function in a remote server which receives a dataset and makes (or at least should do) necessary updates. However, Im receiving this error
message in my client browser interface:

"Object Reference not defined for an instance of an object.

Details of execution: System.NullReferenceException: Object Reference not
defined for an instance of an object."

My function is only this:
public bool UpdateDataSet (DataSet DS)

{

OracleDataAdapter adapter;

adapter.Update(DS);

return true;

}

So, any good soul could help me to update a data base using a daaset with
functions update from OracleDataAdapter ? I aprecciate very much your
atention.

Fernanda Menks

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tc | last post by:
Hi, I was curious, I am thinking of writing an application that loads a dataset from a database that resides on a server. The question I have is this, if multiple copies of the app will be...
2
by: LC | last post by:
I am on the learn C#. Net in 695 day program. I am just trying to learn stuff. I have MSAccess database with 1 table called 'ParmDate' with 1 column called 'ParmDate' which represents a date for...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
10
by: jaYPee | last post by:
does anyone experienced slowness when updating a dataset using AcceptChanges? when calling this code it takes many seconds to update the database SqlDataAdapter1.Update(DsStudentCourse1)...
14
by: Lars Netzel | last post by:
A little background: I use three Datagrids that are in a child parent relation. I Use Negative Autoincrement on the the DataTables and that's workning nice. My problem is when I Update these...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
2
by: marcmc | last post by:
Hey, I have never used a datagrid/dataset/adaptor/table method for updating data, I have always used direct updates to the database so ADO is quite new to me. I have a datagrid and I change a...
0
by: Johnny | last post by:
I have a PocketPC mobile application that gets its data from the Sql Server database via a web service. The web service returns a dataset that I need to load into the SqlCe database on the mobile...
0
by: OldStd | last post by:
Updating data using 2 data sets I am having some problems in updating the database using two datasets as suggested by someone. 1. Data is displayed in a data grid from a dataset generated using...
1
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.