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 

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)

where did i go wrong? please guide me..

did not quite get your problem, however, i think you could have gone wrong with your sql syntax.

[DateCreated] AS (getdate())

it seems your field has no datatype specified; i am new to sql but maybe it could work well if you specify the date as a default value
[DateCreated] [Date] Default (getdate())
or something along those lines.
honestly thos

COLLATE SQL_Latin1_General_CP1_CI_AS

i have no idea what that means, you could help me with that as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.