|
-
May 12th, 2009, 12:55 PM
#1
Thread Starter
Addicted Member
Possible for a program to get corrupted?
What I mean is corrupted I guess. I have been having nothing but trouble with this scheduling program, and things that should work aren't working. Newest example is this:
System.Data.EvaluateException was unhandled
Message="Cannot find column [ID]."
That is thrown in this code:
Code:
Private Sub cmbdoctor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbDoctor.SelectedIndexChanged
If Me.cmbDoctor.SelectedIndex > 0 Then
' get new owner
_owner = Me.cmbDoctor.SelectedItem
' apply filter to C1Schedule's data source (show only current owner's appointments)
Dim v As System.ComponentModel.IBindingListView
v = C1Schedule1.DataStorage.AppointmentStorage
C1Schedule1.BeginUpdate()
v.Filter = "ID='" + _owner.Index.ToString() + "'"
' Set default value for Appointment table Owner column (equal to the current owner index)
Me.TestAppointmentDataBaseDataSet1.Appointment.IDColumn.DefaultValue = _owner.Index
C1Schedule1.EndUpdate()
ElseIf Me.cmbDoctor.SelectedIndex = 0 Then
Dim v As System.ComponentModel.IBindingListView
v = C1Schedule1.DataStorage.AppointmentStorage
v = C1Schedule1.DataStorage.AppointmentStorage
v.Filter = ""
End If
Right at the v.filter it's giving that error. I used this SAME exact code in a sample program, with the same exact data source and tables and it works fine. The ID column is certainly in both tables I'm having it look at, and I fill them at form load. Not only this, but any time I add a data source I have to go into the designer.vb and add "Global" to every instance of data. When I add a new data source it removes all the Globals and I have to do it all over again.
So, is this thing just messed up and should I start over or what?
-
May 12th, 2009, 05:04 PM
#2
Thread Starter
Addicted Member
Re: Possible for a program to get corrupted?
-
May 12th, 2009, 05:13 PM
#3
Re: Possible for a program to get corrupted?
I would be very hesitant to have a column called ID. Whether it is contributing to your problems in this case, I don't know, but MS uses that particular pair of characters for some strange and hidden things. I first encountered this when I used a table that had an ID column as a primary key. When I output the data into the textfile, and tried to open it in Excel, I would get an 'Invalid File Type' error. It turned out that a textfile that starts with those two characters indicates something, though I don't know what. It could be that there is some meaning in this case, as well, so I would treat ID as if it was a reserved word.
As for the other, tinkering with the designer can cause some odd behavior. I haven't seen exactly what you describe, but I have seen other oddities.
My usual boring signature: Nothing
 
-
May 12th, 2009, 05:16 PM
#4
Thread Starter
Addicted Member
Re: Possible for a program to get corrupted?
I actually did rename it to something else before, it must have found its way back in. I still don't understand why the exact code and data source works with one and not the other, that makes no sense.
-
May 12th, 2009, 06:12 PM
#5
Re: Possible for a program to get corrupted?
Not to me, either. It IS possible for code to become corrupted. I have never had to do it myself, but I see suggestions to empty the bin and object directories in the project directory and rebuild the code. I don't have any confidence in that, though.
I would put a breakpoint on the line that is causing the problem, which I assume is v.Filter, and take a look at v. It may not be what you think it is.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|