Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET Database and Reporting (http://www.xtremevbtalk.com/-net-database-and-reporting/)
-   -   default value for a timestamp field (http://www.xtremevbtalk.com/-net-database-and-reporting/327709-default-value-timestamp-field.html)

pschulz 07-24-2015 05:55 PM

default value for a timestamp field
 
Hi there,

is there no way to have a timestampColumn within an Insert statement?
I could keep it out of course but sometimes, its needed.

This are 2 examples I've tried, but have still an error
Code:

Dim strTimestamp As String = String.Empty

mySQLCommand.Parameters.AddWithValue("@TimestampClm", SqlDbType.Timestamp)
mySQLCommand.Parameters("@TimestampClm").Value = strTimestamp



And even this one hasnt work
Code:

Dim myNull As SqlDateTime
myNull = SqlDateTime.Null

mySQLCommand.Parameters.AddWithValue("@TimestampClm", SqlDbType.Timestamp)
mySQLCommand.Parameters("@TimestampClm").Value = myNull

greetings and thanks

PlausiblyDamp 07-25-2015 06:43 AM

A column of type timestamp isn't meant to be inserted into, it exists as an autogenerated column type (https://technet.microsoft.com/en-us/...v=sql.80).aspx has more details).

Is there a reason why you need to insert a null / empty timestamp into a row?

pschulz 07-25-2015 01:58 PM

Hi PlausiblyDamp's, thanks for now.

Well, if nothing is inserted, than this column doesnt have any value, is empty. Or is there something I dont see?

I'm pleasure if this is normaly filled by autogenerated, but never saw it so.


All times are GMT -6. The time now is 10:19 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.