0

hi..
i've created a table named :Survey

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..

1
Contributor
1
Reply
2
Views
10 Years
Discussion Span
Last Post by shy_wani
0

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..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.