473,386 Members | 1,958 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,386 software developers and data experts.

Exception Error

I am getting the following error:

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
Line 192:
Line 193: Private Sub btnDeleteUser_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnDeleteUser.Click
Line 194:
DsUsers1.Tables("UserAuth").Rows.Find(ddlUsers.Sel ectedItem.Value).Delete()
Line 195: SqlDataAdapter1.Update(DsUsers1, "UserAuth")
Line 196: End Sub

I have stepped through the code and determined that there is not a null
value in the drop down list. Any help would be appreciated.
Nov 19 '05 #1
3 1288
DsUsers1 could be null

a table named "UserAuth" might not exist.

No rows might be found

SqlDataAdapter1 might not exist

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"JackO" <Ja***@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...
I am getting the following error:

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
Line 192:
Line 193: Private Sub btnDeleteUser_Click(ByVal sender As
System.Object,
ByVal e As System.EventArgs) Handles btnDeleteUser.Click
Line 194:
DsUsers1.Tables("UserAuth").Rows.Find(ddlUsers.Sel ectedItem.Value).Delete()
Line 195: SqlDataAdapter1.Update(DsUsers1, "UserAuth")
Line 196: End Sub

I have stepped through the code and determined that there is not a null
value in the drop down list. Any help would be appreciated.

Nov 19 '05 #2
I have created the dataset DsUsers1 and dropped it on my Web Form. I have
made sure that the data exists by generating a data list from the data
adapter SqlDataAdapter1 which is also on my Web form. I created the
"UserAuth" table myself and I am able to add records through the ASP.NET
codebehind function I wrote. Any insight into why I am getting this error
when I try and delete a record would be appreciated.

"Karl Seguin" wrote:
DsUsers1 could be null

a table named "UserAuth" might not exist.

No rows might be found

SqlDataAdapter1 might not exist

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"JackO" <Ja***@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...
I am getting the following error:

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
Line 192:
Line 193: Private Sub btnDeleteUser_Click(ByVal sender As
System.Object,
ByVal e As System.EventArgs) Handles btnDeleteUser.Click
Line 194:
DsUsers1.Tables("UserAuth").Rows.Find(ddlUsers.Sel ectedItem.Value).Delete()
Line 195: SqlDataAdapter1.Update(DsUsers1, "UserAuth")
Line 196: End Sub

I have stepped through the code and determined that there is not a null
value in the drop down list. Any help would be appreciated.


Nov 19 '05 #3
I gave you all the possible answers. I don't think there can be any. Put a
breakpoint, debug and add a watch to each of these cases and an answer ye
shall find.

My gut is that the Find() returns nothing...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"JackO" <Ja***@discussions.microsoft.com> wrote in message
news:89**********************************@microsof t.com...
I have created the dataset DsUsers1 and dropped it on my Web Form. I have
made sure that the data exists by generating a data list from the data
adapter SqlDataAdapter1 which is also on my Web form. I created the
"UserAuth" table myself and I am able to add records through the ASP.NET
codebehind function I wrote. Any insight into why I am getting this error
when I try and delete a record would be appreciated.

"Karl Seguin" wrote:
DsUsers1 could be null

a table named "UserAuth" might not exist.

No rows might be found

SqlDataAdapter1 might not exist

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"JackO" <Ja***@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...
>I am getting the following error:
>
> Exception Details: System.NullReferenceException: Object reference not
> set
> to an instance of an object.
>
> Source Error:
>
>
> Line 192:
> Line 193: Private Sub btnDeleteUser_Click(ByVal sender As
> System.Object,
> ByVal e As System.EventArgs) Handles btnDeleteUser.Click
> Line 194:
> DsUsers1.Tables("UserAuth").Rows.Find(ddlUsers.Sel ectedItem.Value).Delete()
> Line 195: SqlDataAdapter1.Update(DsUsers1, "UserAuth")
> Line 196: End Sub
>
> I have stepped through the code and determined that there is not a null
> value in the drop down list. Any help would be appreciated.


Nov 19 '05 #4

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

Similar topics

6
by: Daniel Wilson | last post by:
I am having exception-handling and stability problems with .NET. I will have a block of managed code inside try...catch and will still get a generic ..NET exception box that will tell me which...
7
by: Ekim | last post by:
hy, I've a question concerning exception-handling in c++: is there a possibility to catch any exception (I know one can do that by "catch(...)") and display its default-error-message (like in...
44
by: craig | last post by:
I am wondering if there are some best practices for determining a strategy for using try/catch blocks within an application. My current thoughts are: 1. The code the initiates any high-level...
40
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
3
by: will | last post by:
Hi all. I've got an question about how to catch an exception. In Page_Load, I place a DataGrid, dg1, into edit mode. This will call the method called GenericGridEvent. GenericGridEvent will call...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
9
by: Claudio Di Flumeri | last post by:
Hello all, I've added a global exception handler to my application in this way: Sub Main() AddHandler Application.ThreadException, AddressOf ThreadException AddHandler...
132
by: Zorro | last post by:
The simplicity of stack unraveling of C++ is not without defective consequences. The following article points to C++ examples showing the defects. An engineer aware of defects can avoid...
2
by: Darko Miletic | last post by:
Recently I wrote a dll in c++ and to simplify the distribution I decided to link with multithreaded static library (/MT or /MTd option). In debug everything works fine but in release I get this: ...
3
by: Robert Rawlins | last post by:
Hi Mk, Yeah it's got me a little bemused to be honest, I've tried playing around with configuration options this morning and not been able to achieve anything that works properly. I'll keep...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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...

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.