User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 402,578 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,252 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser: Programming Forums
Views: 811 | Replies: 1 | Solved
Reply
Join Date: Mar 2007
Posts: 34
Reputation: shy_wani is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
shy_wani shy_wani is offline Offline
Light Poster

my is my date keep on changing???

  #1  
Apr 29th, 2007
hi..
i've created a table named urvey

CREATE TABLE [dbo].[Survey] (
    [CustomerID] [int] NOT NULL ,
    [SurveyID] [int] IDENTITY (1, 1) NOT NULL ,
    [SurveyTitle] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    [SurveyDescription] [varchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
    [DateCreated] AS (getdate()) ,
    [coverletter] [varchar] (250) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

my problem is regarding my DateCreated.. when system created through my page in aspx, the survey input are correctly stored in the database except for DateCreated where the whole table Column DateCreated changes its date to date at time the last survey was created....

my code for inserting in survey.aspx

Dim strTitle As String = title.Text
Dim strDescription As String = description.Text
sql2 = "INSERT INTO Survey(CustomerID,SurveyTitle,SurveyDescription) VALUES('" & Session("sCustomerID") & "','" & strTitle & "','" & strDescription & "')"
cmd2 = New SqlCommand(sql2, MyConnection)
cmd2.ExecuteNonQuery()


where did i go wrong? please guide me..
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2007
Posts: 34
Reputation: shy_wani is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
shy_wani shy_wani is offline Offline
Light Poster

Re: my is my date keep on changing???

  #2  
Apr 29th, 2007
ok..ok
finally i understand..
now i've changed my column DateCreated in MSSQL to accept null values..

and inside my form at ASP.NET..i've changed my sql statement to..
 sql2 = "INSERT INTO Survey(CustomerID,SurveyTitle,SurveyDescription,DateCreated) VALUES('" & Session("sCustomerID") & "','" & strTitle & "','" & strDescription & "',CURRENT_TIMESTAMP)"

and now it's finally work..
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS SQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 11:01 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC