|
-
Oct 7th, 2013, 10:07 PM
#1
Thread Starter
Lively Member
DateTimePicker Database problem
Hello,
I am having a tough time debugging a code. I would appreciate some help.
In my form, I have a DateTimePicker that is connected to a database. I entered a date manually in the database and when I load the form, it reads the date and displays it just fine. However, when I pick a date in the datepicker, and update the database, the following error comes up and the operation fails:
Code:
The column name is not valid. [ Node name (if any) = ,Column name = DateTimePickerMembershipExpiration ]
In the table schema, the data type for that field was date and failed to convert. I made it nvarchar and that error pops up. Not sure what the problem is since it reads it on form load so it DOES exist.
Any ideas?
Best,
Kalogerus Productions (K-Pro)

-
Oct 7th, 2013, 10:22 PM
#2
Re: DateTimePicker Database problem
Why would you have a database column name that contained "DateTimePicker"? The type of control used in the UI to display and edit that data is completely irrelevant to the database. It would appear that the appropriate name for that column would be "MembershipExpirationDate" and the data type absolutely should be 'date' or 'datetime' or whatever's similar in the database you're using.
Controls are not connected to databases. Controls can be bound to local lists. You probably have it bound to a DataTable. That DataTable may be based on the schema of the database but it is not the database.
What property of the DateTimePicker did you bind to? Was it Text or Value? Can that column accept NULL values? If so then you can't bind to a DateTimePicker because it doesn't support binding to nullable data. What are the database table and column names? What are the DataTable and DataColumn Names? What is the DateTimePicker data-binding expression?
-
Oct 7th, 2013, 10:54 PM
#3
Thread Starter
Lively Member
Re: DateTimePicker Database problem
Whoa brain-freeze I guess. I just realized the name didn't exist for a reason. I suspected something but didn't quite catch it. Thank you for pointing it out.
Best
Kalogerus Productions (K-Pro)

-
Oct 7th, 2013, 11:31 PM
#4
Thread Starter
Lively Member
Re: DateTimePicker Database problem
Last edited by K-PRO; Oct 7th, 2013 at 11:35 PM.
Kalogerus Productions (K-Pro)

-
Oct 7th, 2013, 11:38 PM
#5
Re: DateTimePicker Database problem
Tags for this Thread
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
|