473,657 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do insert into a DB

I have a database field of type datetime. This field should store a system
time when a record is inserted. The other fields in the record are bound to a
control and I have no problems with them. I tried setting the datetime field
with a default value using getdate(), but it still does not work. How can I
use a statement similar these beow to achieve this?

My current code:

<InsertParamete rs>
<asp:ControlPar ameter Name="BillingAd dress" Type="String"
ControlID="Bill ingAddress" PropertyName="T ext" />
<asp:ControlPar ameter Name="BillingCi ty" Type="String"
ControlID="Bill ingCity" PropertyName="T ext" />

<!-- This is where my problem is !-->
<asp:ControlPar ameter Name="SignUpDat e" Type="String" .... />

--
L. A. Jones
May 12 '07 #1
2 972
On May 12, 4:08 pm, Dave <D...@discussio ns.microsoft.co mwrote:
I have a database field of type datetime. This field should store a system
time when a record is inserted. The other fields in the record are bound to a
control and I have no problems with them. I tried setting the datetime field
with a default value using getdate(), but it still does not work. How can I
use a statement similar these beow to achieve this?

My current code:

<InsertParamete rs>
<asp:ControlPar ameter Name="BillingAd dress" Type="String"
ControlID="Bill ingAddress" PropertyName="T ext" />
<asp:ControlPar ameter Name="BillingCi ty" Type="String"
ControlID="Bill ingCity" PropertyName="T ext" />

<!-- This is where my problem is !-->
<asp:ControlPar ameter Name="SignUpDat e" Type="String" .... />

--
L. A. Jones
SQL Server?

I think, you can specify the date in the statement:

InsertCommand=" INSERT INTO... getdate()....

You can also create a constraint for the table, it will add a date
automatically

ALTER TABLE [tablename] ADD
CONSTRAINT [somename] DEFAULT (getdate()) FOR [columnname]
GO

May 12 '07 #2
I agree with Alexey. Also, I wanted to add that maybe your problem is
that your are missing the quotes around the date. If you are sending
a date to SQL Server as a string (which is fine) be sure to treat it
like a string and put quotes around it.

May 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2510
by: Howard Hinnant | last post by:
I recently asked for a survey of multimap insert with hint behavior, in support of a paper I'm writing concerning lwg issue 233. My sincere thanks to Beman Dawes, Raoul Gough, Russell Hind, Bronek Kozicki, Nicola Musatti, John Potter and Maxim Yegorushkin for helping with that survey. Since I started work on this paper at least two people I respect very much have expressed interest in nailing down the "insert without hint" function a...
6
7000
by: Mark P | last post by:
Some time ago I posted here about inserting into a set with a hint: http://groups-beta.google.com/group/alt.comp.lang.learn.c-c++/browse_thread/thread/fb75b00f73e979db/018b8d0eadb38dbf?q=%22STL+insert+with+hint%22+%22Mark+P%22&rnum=1&hl=en#018b8d0eadb38dbf I quoted the SGI STL docs describing a.insert(p, t), where p is the hint iterator and t is the inserted object: "Insert with hint is logarithmic in general, but it is amortized...
14
4286
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to salvage the records from the many table and without going into detail, one of the reasons I can't do the opposite as there are records in the ONE table that I need to keep even if they don't have any child records in the MANY table. Below I created...
2
3195
by: Geoffrey KRETZ | last post by:
Hello, I'm wondering if the following behaviour is the correct one for PostGreSQL (7.4 on UNIX). I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching the following request : INSERT INTO temp_tab VALUES (1,2,3)
3
2305
by: MP | last post by:
Hi Posted this several hours ago to another ng but it never showed up thought i'd try here. using vb6, ado, .mdb, jet4.0, no access given table tblJob with field JobNumber text(10) 'The example I had to go by 'INSERT INTO tblCustomers (CustomerID, , )
0
8407
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8837
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8512
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.