Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Error: Object reference not set to an instance of an object

SteveHi

New member
Joined
Jun 4, 2014
Messages
469
Joined
May 20, 2005
Messages
104,556
In the uniqueCode column there is a value, something like this a3c5c318882x457291b5551b0b322937.

That's not elevant. It's the value you're using to set the parameter that matters. Just debug your code. Put a breakpoint on the line I flagged earlier and then, when it's hit, test the value of Request.QueryString("uniqueCode").
 

SteveHi

New member
Joined
Jun 4, 2014
Messages
469
I put a breakpoint here:

Code:
cmd.Parameters.AddWithValue("@uniqueCode", Convert.ToString(Request.QueryString("uniqueCode")))

In the Call Stack I get this:

App_Web_4bws0rdk.dll!newPassword.Page_Load(Object sender, System.EventArgs e) Line 31 Basic

which doesn't mean much to me.

This is what I can see:

View attachment 158361

So the error seems to be this:

An exception of type 'System.Data.OleDb.OleDbException' occurred in System.Data.dll but was not handled in user code
{"Parameter @uniqueCode has no default value."}

How to correct it is something else as VS does not provide guidance.
 

OptionBase1

New member
Joined
Nov 22, 2017
Messages
987
If I were in your shoes, the first thing I would be doing is taking several steps back and using code with known values to see if i get expected results. That might mean modifying your SQL statement to have hard-coded values in the query and not even using parameters to start with. Then, once that is determined to be working, then use parameters with hard-coded values rather than trying to pull values from Request.QueryString. And so on.

In order for Request.QueryString to return values, those values have to be passed at the end of the URL with name=value pairs, like ResetPassword.aspx?uniqueCode=xyz&strEmail=something@somedomain.com

If your URL's don't look like that, then you have to resolve that issue first before you can try to pull values with Request.QueryString
 
Joined
May 20, 2005
Messages
104,556
I put a breakpoint here:

Code:
cmd.Parameters.AddWithValue("@uniqueCode", Convert.ToString(Request.QueryString("uniqueCode")))

Wonderful. That's half of what I said to do. Now where's the other half? Why have you not determined what the value of Request.QueryString("uniqueCode") is and relayed that to us? If you ask for help and then ignore instructions from those trying to help then what's the point? If you're not going to do as I suggest then you're wasting my time and I'm not likely to feel inclined to volunteer more of it. What is the issue here? Do you not know how to evaluate that expression? If not, say so. If you do, why are you refusing to do it?
 
Joined
May 20, 2005
Messages
104,556
You seem to lack any knowledge of how to debug your code if you can't evaluate a simple expression in the debugger. That should be your first order of business. Debugging is a critical skill for a developer and you aren't going to be able to get far without it. I suggest that you search the web and do some reading on debugging in VB.NET. You need to be able to set breakpoints, step through code and use tools like the Autos, Locals, Watch and Immediate windows to evaluate the state of your application as you step.
 

NeedSomeAnswers

Superbly Moderated
Joined
Jun 4, 2002
Messages
2,610
take this line -
Code:
Convert.ToString(Request.QueryString("uniqueCode")

and add it to a variable

Code:
dim test as string 

test = Convert.ToString(Request.QueryString("uniqueCode")

bookmark this line and when you run the code hover over "test" and see what its value is.

Your error appears to suggest that it doesn't have a value, so checking whether it does or not should be your next step
 

ahs001

New member
Joined
Apr 1, 2020
Messages
1
can any one help I'm getting the same error.
I trying to open my crystal report using crystal report viewer
 
Top