Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old August 25th, 2009, 04:18 PM
Registered User
 
Join Date: Aug 2009
Location: Oklahoma, USA
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy 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
Reply With Quote
  #2 (permalink)  
Old August 25th, 2009, 04:31 PM
Imar's Avatar
Wrox Author
Points: 66,761, Level: 100
Points: 66,761, Level: 100 Points: 66,761, Level: 100 Points: 66,761, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,147
Thanks: 65
Thanked 1,391 Times in 1,371 Posts
Default

Yes, it's SQL Server specific. Have you tried Date()?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old August 25th, 2009, 04:40 PM
Registered User
 
Join Date: Aug 2009
Location: Oklahoma, USA
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #4 (permalink)  
Old August 25th, 2009, 06:00 PM
Imar's Avatar
Wrox Author
Points: 66,761, Level: 100
Points: 66,761, Level: 100 Points: 66,761, Level: 100 Points: 66,761, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,147
Thanks: 65
Thanked 1,391 Times in 1,371 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old August 25th, 2009, 06:26 PM
Registered User
 
Join Date: Aug 2009
Location: Oklahoma, USA
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
__________________
If all you have is a hammer, then everything looks like a nail.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
getdate Not Working ~Bean~ SQL Server 2000 4 September 7th, 2005 11:31 PM
GETDATE? drachx SQL Server 2000 2 February 17th, 2005 07:05 AM
Using GETDATE in an In-Line function Mitch SQL Server 2000 13 March 25th, 2004 07:46 AM
seconds missing in getdate() stufflebeem SQL Server 2000 1 October 24th, 2003 04:52 PM
GETDATE() dose not......... arshad mahmood SQL Server 2000 2 August 19th, 2003 07:57 AM



All times are GMT -4. The time now is 11:32 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.