 |
BOOK: Professional Visual Studio 2008 ISBN: 978-0-470-22988-0
 | This is the forum to discuss the Wrox book Professional Visual Studio 2008 by Nick Randolph, David Gardner; ISBN: 9780470229880 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Professional Visual Studio 2008 ISBN: 978-0-470-22988-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

August 25th, 2009, 04:18 PM
|
Registered User
|
|
Join Date: Aug 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
GetDate() function in Chp 21
I'm using this to update a date/time field, and at runtime, it can't find the function. Is this function a SQL/server function? I'm using Access as my database.
I've even tried NOW()... data type mis-match error
Can you recommend anything to fix this?
Thanks
Rick
|

August 25th, 2009, 04:31 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes, it's SQL Server specific. Have you tried Date()?
Imar
|

August 25th, 2009, 04:40 PM
|
Registered User
|
|
Join Date: Aug 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Imar, yes I tried Date() and the 'query builder' gives an error of:
'Your entry cannot be converted to a valid date/time value.'
I've tried 'TO_Date()'... runtime not found
I've tried several permutations there of and either gotten 'runtime not found' OR the same as above.
I'm using a combination of a datagridview(minimal columns) and a 'detail view'(all columns, with the update-date in a label, since "I" want to set it and not the user)
Is there a way to get control of the datarow and hence the date-update field, before the bindingsource.endedit and the tableadapter.update run? (it's the update that's giving me grief; for about 2 weeks now).
Thanks
|

August 25th, 2009, 06:00 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
How are you using the Date() method in your SQL code? This works for me:
INSERT INTO MyTable ( CreateDate) VALUES (Date());
When you are assigning a value from the .NET world, have you tried System.DateTime.Now?
Other than that, hard to suggest something. I am not too experienced with desktop databinding. Maybe posting your relevant code sheds some light or brings somebody else with the answer to this thread.
Cheers,
Imar
|

August 25th, 2009, 06:26 PM
|
Registered User
|
|
Join Date: Aug 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Imar,
Thanks again. I did try the 'NOW()' function... I didn't use system.datetime.now in the query builder, but it's an idea... I will try it.
However, I have created a work-around. I created another updatequery and using the records 'autonumber' as the 'where' criteria, I'm able to force the record to update. The way I gain control of the data is that, since I'm displaying all the data anyway, I just validate and modify the 'textboxes' data, and the update uses the now() query as 'just another parameter'. The problem I had before was, I was trying to use NOW() in the 'query-builder' process... there it does not seem to work.
I can't paste a screen shot, but it's where you can modify the 'dataset-designed' query, and type in an 'expression' in the 'Set Value' column... anyway. Like I said I've made a work-around and here's my code that does work:
Quote:
Me.TblObserverTableAdapter.MyUpdateQuery(Ob_IDText Box.Text, Ob_FNameTextBox.Text, Ob_MIDTextBox.Text, Ob_LNameTextBox.Text, Ob_PasswordTextBox.Text, tempphone, tempcell, Ob_EmailTextBox.Text, Org_IDTextBox.Text, Now(), Ob_TypeTextBox.Text, Ob_AutoNumberTextBox.Text)
|
Rick
|
|
 |