Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
shemayb
Posting Yak Master
159 Posts |
Posted - 2007-08-13 : 14:18:10
|
What is meants by this exception: system.NullReferenceException object reference not set to an instance of an object?thanks!Funnyfrog |
|
chrisrock
Starting Member
12 Posts |
Posted - 2007-08-13 : 14:40:57
|
One of your defined objects is null and you're trying to use it.For instance:System.Data.Sql.SqClient.SqlConnection cn;cn.Open(); <-- this will cause that error because cn has not been instantiated yet.This will work:System.Data.Sql.SqClient.SqlConnection cn = new System.Data.Sql.SqClient.SqlConnection("my connection string here");cn.Open(); Do you have the code where this is happening? |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2007-08-13 : 15:04:17
|
This is my code: if (rdoRSO.Checked==true) dv = Physicians.GetPhysiciansDropdown(AgencyId, BranchId, lookupchar); else dv = Physicians.GetPTOassignedPhysiciansDropdown(AgencyId, BranchId, lookupchar, patientId, patientIntakeId);When i will put this one if (rdoRSO.Checked==true) in my code i will have that error. What should i do?Funnyfrog |
|
|
jhermiz
3564 Posts |
Posted - 2007-08-13 : 15:23:46
|
Show us the code before the if, how do you instantiat the rdoRSO object, what is its type, etc. etc.Programmers HowTo's -- [url]http://jhermiz.googlepages.com[/url] |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2007-08-13 : 15:29:16
|
if (rdoRSO.Checked==true),this is a radiobutton..i don't know how to instantiate a radiobutton in this case..i haven't instantiated it..Funnyfrog |
|
|
jhermiz
3564 Posts |
Posted - 2007-08-13 : 15:33:08
|
ok a radio button is throwing this?try justif(rdoRSO.Checked) { }Programmers HowTo's -- [url]http://jhermiz.googlepages.com[/url] |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2007-08-13 : 15:36:53
|
I want to place my if statement inside a function that was called during the loading of the page.Is it okey to place it inside a function instead of inside the radiobutton event?Funnyfrog |
|
|
shemayb
Posting Yak Master
159 Posts |
Posted - 2007-08-13 : 17:12:50
|
when i run the debug my if(rdoRSO.Checked)code has a null value..How can i put a value to it?Funnyfrog |
|
|
|
|
|