473,402 Members | 2,050 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,402 software developers and data experts.

Error when deleting last record

I have an error when I try to delete last record in the record set. The code
I'm using is:
lcurrow = Me.BindingContext(DsTextProdMain,
"TextProductsMain").Current
lcurrow.Delete()
This code works for all records in the recordset except last one. But if
recordset contains only one record the code works fine. The error is coming
out only in 2003 version, 2002 version works fine.

The system give me a not understandable error.

An unhandled exception of type 'System.NullReferenceException' occurred in
system.data.dll

Additional information: Object reference not set to an instance of an object.

Is somebody met this behabior?
Nov 21 '05 #1
5 1547
Hi Bronislav,

Sounds strange. You say 'recordset', so I have to ask - are you using ado
or ado.net? If ado.net, I'd recommend you post to
microsoft.public.dotnet.adonet.

Bernie Yaeger

"Bronislav" <Br*******@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
I have an error when I try to delete last record in the record set. The
code
I'm using is:
lcurrow = Me.BindingContext(DsTextProdMain,
"TextProductsMain").Current
lcurrow.Delete()
This code works for all records in the recordset except last one. But if
recordset contains only one record the code works fine. The error is
coming
out only in 2003 version, 2002 version works fine.

The system give me a not understandable error.

An unhandled exception of type 'System.NullReferenceException' occurred in
system.data.dll

Additional information: Object reference not set to an instance of an
object.

Is somebody met this behabior?

Nov 21 '05 #2
Hi Bronislav,

Sounds strange. You say 'recordset', so I have to ask - are you using ado
or ado.net? If ado.net, I'd recommend you post to
microsoft.public.dotnet.adonet.

Bernie Yaeger

"Bronislav" <Br*******@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
I have an error when I try to delete last record in the record set. The
code
I'm using is:
lcurrow = Me.BindingContext(DsTextProdMain,
"TextProductsMain").Current
lcurrow.Delete()
This code works for all records in the recordset except last one. But if
recordset contains only one record the code works fine. The error is
coming
out only in 2003 version, 2002 version works fine.

The system give me a not understandable error.

An unhandled exception of type 'System.NullReferenceException' occurred in
system.data.dll

Additional information: Object reference not set to an instance of an
object.

Is somebody met this behabior?

Nov 21 '05 #3
Hi Bernie
I'm using ado.net
Thanks, Bronislav.

"Bernie Yaeger" wrote:
Hi Bronislav,

Sounds strange. You say 'recordset', so I have to ask - are you using ado
or ado.net? If ado.net, I'd recommend you post to
microsoft.public.dotnet.adonet.

Bernie Yaeger

"Bronislav" <Br*******@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
I have an error when I try to delete last record in the record set. The
code
I'm using is:
lcurrow = Me.BindingContext(DsTextProdMain,
"TextProductsMain").Current
lcurrow.Delete()
This code works for all records in the recordset except last one. But if
recordset contains only one record the code works fine. The error is
coming
out only in 2003 version, 2002 version works fine.

The system give me a not understandable error.

An unhandled exception of type 'System.NullReferenceException' occurred in
system.data.dll

Additional information: Object reference not set to an instance of an
object.

Is somebody met this behabior?


Nov 21 '05 #4
Hi Bernie
I'm using ado.net
Thanks, Bronislav.

"Bernie Yaeger" wrote:
Hi Bronislav,

Sounds strange. You say 'recordset', so I have to ask - are you using ado
or ado.net? If ado.net, I'd recommend you post to
microsoft.public.dotnet.adonet.

Bernie Yaeger

"Bronislav" <Br*******@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
I have an error when I try to delete last record in the record set. The
code
I'm using is:
lcurrow = Me.BindingContext(DsTextProdMain,
"TextProductsMain").Current
lcurrow.Delete()
This code works for all records in the recordset except last one. But if
recordset contains only one record the code works fine. The error is
coming
out only in 2003 version, 2002 version works fine.

The system give me a not understandable error.

An unhandled exception of type 'System.NullReferenceException' occurred in
system.data.dll

Additional information: Object reference not set to an instance of an
object.

Is somebody met this behabior?


Nov 21 '05 #5
Bronislav,

As Bernie wrote is using a recordset ADODB,.

However I dont believe you are using a recordset, so please do not write
that next time.

A recordset has absolute no equalitiys with a dataset. One of the aspects is
by instance that a recordset is only one connected datatable. (While a
datatable in a dataset is disconnected).

Did you try already something as this. (Changed in this message so watch
typos or whatever).
\\\
Dim cm As CurrencyManager = _
DirectCast(BindingContext(DsTextProdMain," TextProductsMain").dtVBreg),
CurrencyManager)
If DsTextProdMain.tables("TextProductsMain").rows.Cou nt > 0 Then
DsTextProdMain.tables("TextProductsMain").rows(cm. Position).Delete()
End If
///

Be aware I tried to take the datasource as you used in your message, I do
not know if that is the used one.

I hope this helps?

Cor

"Bronislav" <Br*******@discussions.microsoft.com>
Hi Bernie
I'm using ado.net
Thanks, Bronislav.

"Bernie Yaeger" wrote:
Hi Bronislav,

Sounds strange. You say 'recordset', so I have to ask - are you using
ado
or ado.net? If ado.net, I'd recommend you post to
microsoft.public.dotnet.adonet.

Bernie Yaeger

"Bronislav" <Br*******@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
>I have an error when I try to delete last record in the record set. The
>code
> I'm using is:
> lcurrow = Me.BindingContext(DsTextProdMain,
> "TextProductsMain").Current
> lcurrow.Delete()
> This code works for all records in the recordset except last one. But
> if
> recordset contains only one record the code works fine. The error is
> coming
> out only in 2003 version, 2002 version works fine.
>
> The system give me a not understandable error.
>
> An unhandled exception of type 'System.NullReferenceException' occurred
> in
> system.data.dll
>
> Additional information: Object reference not set to an instance of an
> object.
>
> Is somebody met this behabior?


Nov 21 '05 #6

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

Similar topics

6
by: Matthew Louden | last post by:
The following ASP code yields the following error, but actually the new record is stored in database. The same error happens when the application deletes a record, such as sqlStmt ="delete from...
8
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: ...
1
by: Dalan | last post by:
I'm experiencing a Query Syntax Error with an Access 97 Db. Actually, the query performs as expected when adding any new records or editing existing ones and even deleting records, EXCEPT when the...
2
by: Ronny Sigo | last post by:
Hello all, I have made a form with a button to delete the current record. When clicking the button, I get a errmsg "Reserved error" I don't know what this means. And even though I have put...
0
by: RAllsopp | last post by:
I am having trouble deleting a record from a subform. I actually have a main form with two subforms, one dependent on the record selected in the other. The user selects a record to view on the...
1
by: iam247 | last post by:
Hi I am a relative beginner with SQL and ASP. With some help after previous posts I have a page which successfully requests querystrings from another page and deletes a record from an access...
0
by: Bronislav | last post by:
I have an error when I try to delete last record in the record set. The code I'm using is: lcurrow = Me.BindingContext(DsTextProdMain, "TextProductsMain").Current lcurrow.Delete() This code...
7
by: flupke | last post by:
Hi, i'm getting errors with the log module concerning RotatingFileHandler. I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous python versions but since i upgraded to 2.4.3...
10
by: jpatchak | last post by:
Hi, I have a form with a delete button. Each record is stored with a list name (e.g. "October" or "November"). Each record within a list name is consecutively numbered from 1 to n. This number...
5
by: prakashwadhwani | last post by:
The Delete Event/Proc & "Save_Fields_In_Form_Header" Event/Proc in my form were working perfectly. However, after I added a call to the "Save_Fields_In_Form_Header" Event/Proc in the...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.