I have a question in the following. Any one could give me a help?
Thanks
David
The dataset is declared and created at Class level. My source code is here:
Private Sub lstPatientID_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles lstPatientID.SelectedIndexChanged
txtDebug.Text &= lstPatientID.SelectedIndex.ToString
txtDebug.Text &= lstPatientID.SelectedIndex.ToString
txtLastName.Text =
ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName")
When Page_load,
I use Dropdown list index to set all textboses. Now select another item in
Dropdown list, I got the following error at Line 323:
Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.
Source Error:
Line 321: txtDebug.Text &= lstPatientID.SelectedIndex.ToString
Line 322: txtDebug.Text &= lstPatientID.SelectedIndex.ToString
Line 323: txtLastName.Text =
ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName")
Line: 323 5 3332
txtLastName is null, ds is null or there's no table named "Patients"....we
can't tell which it is, but one of those is true...
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!)
"david" <da***@discussions.microsoft.com> wrote in message
news:97**********************************@microsof t.com... I have a question in the following. Any one could give me a help? Thanks David
The dataset is declared and created at Class level. My source code is
here: Private Sub lstPatientID_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles lstPatientID.SelectedIndexChanged txtDebug.Text &= lstPatientID.SelectedIndex.ToString txtDebug.Text &= lstPatientID.SelectedIndex.ToString txtLastName.Text = ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName")
When Page_load, I use Dropdown list index to set all textboses. Now select another item in Dropdown list, I got the following error at Line 323:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error: Line 321: txtDebug.Text &= lstPatientID.SelectedIndex.ToString Line 322: txtDebug.Text &= lstPatientID.SelectedIndex.ToString Line 323: txtLastName.Text = ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName")
Line: 323
ds is a DataSet.
ds.Tables(0) should be ds.Tables("Patients")
"LastName" is the colunm name.
When Page is first loaded, it OK.
That ocurs when I select a new item of dropdown list.
It is supporsed to bind a new set of data display in all other textbox.
Does it mean the dataset ds has disappeared?
Thanks
David
"Karl Seguin" wrote: txtLastName is null, ds is null or there's no table named "Patients"....we can't tell which it is, but one of those is true...
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!) "david" <da***@discussions.microsoft.com> wrote in message news:97**********************************@microsof t.com... I have a question in the following. Any one could give me a help? Thanks David
The dataset is declared and created at Class level. My source code is here: Private Sub lstPatientID_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles lstPatientID.SelectedIndexChanged txtDebug.Text &= lstPatientID.SelectedIndex.ToString txtDebug.Text &= lstPatientID.SelectedIndex.ToString txtLastName.Text = ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName")
When Page_load, I use Dropdown list index to set all textboses. Now select another item in Dropdown list, I got the following error at Line 323:
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error: Line 321: txtDebug.Text &= lstPatientID.SelectedIndex.ToString Line 322: txtDebug.Text &= lstPatientID.SelectedIndex.ToString Line 323: txtLastName.Text = ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName")
Line: 323
ds wont' automatically survive a postback....are you repopulating it on
postback? Storing it somewhere?
If you have vs.net 2003, debug and step through the code...see what is
null...no point in trying to solve all 3 potential problems until we know
which it is..
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!)
"david" <da***@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com... ds is a DataSet. ds.Tables(0) should be ds.Tables("Patients") "LastName" is the colunm name. When Page is first loaded, it OK. That ocurs when I select a new item of dropdown list. It is supporsed to bind a new set of data display in all other textbox. Does it mean the dataset ds has disappeared?
Thanks
David "Karl Seguin" wrote:
txtLastName is null, ds is null or there's no table named
"Patients"....we can't tell which it is, but one of those is true...
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!) "david" <da***@discussions.microsoft.com> wrote in message news:97**********************************@microsof t.com... I have a question in the following. Any one could give me a help? Thanks David
The dataset is declared and created at Class level. My source code is here: Private Sub lstPatientID_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles lstPatientID.SelectedIndexChanged txtDebug.Text &= lstPatientID.SelectedIndex.ToString txtDebug.Text &= lstPatientID.SelectedIndex.ToString txtLastName.Text = ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName")
When Page_load, I use Dropdown list index to set all textboses. Now select another
item in Dropdown list, I got the following error at Line 323:
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error: Line 321: txtDebug.Text &= lstPatientID.SelectedIndex.ToString Line 322: txtDebug.Text &= lstPatientID.SelectedIndex.ToString Line 323: txtLastName.Text = ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName")
Line: 323
Thank you very much.
How to store the dataset as for a postback?
I have .NET 2003. But I never use the debugging tool.
David
"Karl Seguin" wrote: ds wont' automatically survive a postback....are you repopulating it on postback? Storing it somewhere?
If you have vs.net 2003, debug and step through the code...see what is null...no point in trying to solve all 3 potential problems until we know which it is..
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!) "david" <da***@discussions.microsoft.com> wrote in message news:B6**********************************@microsof t.com... ds is a DataSet. ds.Tables(0) should be ds.Tables("Patients") "LastName" is the colunm name. When Page is first loaded, it OK. That ocurs when I select a new item of dropdown list. It is supporsed to bind a new set of data display in all other textbox. Does it mean the dataset ds has disappeared?
Thanks
David "Karl Seguin" wrote:
txtLastName is null, ds is null or there's no table named "Patients"....we can't tell which it is, but one of those is true...
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!) "david" <da***@discussions.microsoft.com> wrote in message news:97**********************************@microsof t.com... > I have a question in the following. Any one could give me a help? > Thanks > David > > The dataset is declared and created at Class level. My source code is here: > > Private Sub lstPatientID_SelectedIndexChanged(ByVal sender As System.Object, > ByVal e As System.EventArgs) Handles lstPatientID.SelectedIndexChanged > txtDebug.Text &= lstPatientID.SelectedIndex.ToString > txtDebug.Text &= lstPatientID.SelectedIndex.ToString > txtLastName.Text = > ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName") > > When Page_load, > I use Dropdown list index to set all textboses. Now select another item in > Dropdown list, I got the following error at Line 323: > > Exception Details: System.NullReferenceException: Object reference not set > to an instance of an object. > > Source Error: > Line 321: txtDebug.Text &= lstPatientID.SelectedIndex.ToString > Line 322: txtDebug.Text &= lstPatientID.SelectedIndex.ToString > Line 323: txtLastName.Text = > ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName") > > Line: 323 > >
David, left click on the left-side column of VS.Net, a red dot should
appear...that's a breakpoint...Alternatively, you can put your cursor on a
line, goto "Debug" --> "New Breakpoint". Now, hit f5 or "Debug" -->
"Start" which should build and start up your application, launching
IE...now you can browse your site as always, but when the code execution
hits any line with a breakpoint, it'll stop at that line...you can use f10
and f11to step over/in functions/lines....you can add "watches" to
values...play with it...you won't regret it...
You either have to reload the dataset, or store it in the Cache or Session
or some place...
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!)
"david" <da***@discussions.microsoft.com> wrote in message
news:33**********************************@microsof t.com... Thank you very much. How to store the dataset as for a postback? I have .NET 2003. But I never use the debugging tool.
David
"Karl Seguin" wrote:
ds wont' automatically survive a postback....are you repopulating it on postback? Storing it somewhere?
If you have vs.net 2003, debug and step through the code...see what is null...no point in trying to solve all 3 potential problems until we
know which it is..
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!) "david" <da***@discussions.microsoft.com> wrote in message news:B6**********************************@microsof t.com... ds is a DataSet. ds.Tables(0) should be ds.Tables("Patients") "LastName" is the colunm name. When Page is first loaded, it OK. That ocurs when I select a new item of dropdown list. It is supporsed to bind a new set of data display in all other
textbox. Does it mean the dataset ds has disappeared?
Thanks
David "Karl Seguin" wrote:
> txtLastName is null, ds is null or there's no table named "Patients"....we > can't tell which it is, but one of those is true... > > 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!) > "david" <da***@discussions.microsoft.com> wrote in message > news:97**********************************@microsof t.com... > > I have a question in the following. Any one could give me a help? > > Thanks > > David > > > > The dataset is declared and created at Class level. My source code
is > here: > > > > Private Sub lstPatientID_SelectedIndexChanged(ByVal sender As > System.Object, > > ByVal e As System.EventArgs) Handles
lstPatientID.SelectedIndexChanged > > txtDebug.Text &= lstPatientID.SelectedIndex.ToString > > txtDebug.Text &= lstPatientID.SelectedIndex.ToString > > txtLastName.Text = > > ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName") > > > > When Page_load, > > I use Dropdown list index to set all textboses. Now select another item in > > Dropdown list, I got the following error at Line 323: > > > > Exception Details: System.NullReferenceException: Object reference
not set > > to an instance of an object. > > > > Source Error: > > Line 321: txtDebug.Text &=
lstPatientID.SelectedIndex.ToString > > Line 322: txtDebug.Text &=
lstPatientID.SelectedIndex.ToString > > Line 323: txtLastName.Text = > > ds.Tables("Patients").Rows(lstPatientID.SelectedIn dex)("LastName") > > > > Line: 323 > > > > > > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Doslil |
last post by:
I have a form which has a subform.In the main form I have only one
field (this is a drop down list and has a query attached to it) which
selects empno,Name from the EmployeeInformation table.
...
|
by: KCT |
last post by:
I am creating a report screen then look like this :
ItemName Quantity
A 1
B 2
C 3
--End of Page--
The data is not...
|
by: ba |
last post by:
I'm using asp.net 2.0 and am writing a webform using the formview
control.
The <%# Bind("") %> syntax makes sense for textboxes, but I cannot
figure out how to bind a dropdown list to a column....
|
by: goodwill |
last post by:
hi groups i have a problem in bindig data reader to the drop down list
data reader is returnes from a function and system.data.common.dbdatarecord comes in the drop down lsit as compared to data...
|
by: Lori Markle via .NET 247 |
last post by:
Hi, I already posted this but can't find it anywhere!
I'm having a problem that seems very simple. I'm trying to updatea db and am getting stuck on the data binding of a textbox. Iget a "Cannot...
| |
by: Jerome |
last post by:
Hi,
I'm using a FormView for data entry and it works fine so far. With one
exception: I replaced one of the automatically generated textfields by a
dropdown list and the value from that list...
|
by: Shaileshsharma |
last post by:
Hi,
I am facing a problem from last few dayes.I have a Dropdownleast box which is bind with Table DrugMaster which contain around 65 Thausand Drug.
When we use Selected index Change to...
|
by: Danny Ni |
last post by:
Hi,
I am using a method created by other, the function returns List<int>. If I
bind this to a Repeater, what should the data binding expresssion looks
like? <%# Eval("I don't know what to put...
|
by: kennywu |
last post by:
I am using a databound dropdown list bound to a sql datasource in C# .NET environment. When the user opts to delete an entry from the dropdown list, the dropdown list does not reflect the change,...
|
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,...
|
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...
| |
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...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |