January 17, 2004 at 3:20 am
I am building a six page survey and I was wondering if u could give me a few tips or if u know of some sites
that have examples.
One procedure should create the tbl_User_Signup row for the user AND a row in each of
the five one to one tables. It should all be wrapped in a transaction with roll-back
to ensure it either completes successfully or is rolled back for another try.
The methodology for this would:
If the user looses the connection in the middle they can return and the system will take them to the point where they left off.
The data entered before the connection break is safe in the database so they don't have to start over.
For one simple form it is ok to hold the data in memory or the current web page.
What happens if the user decides to cancel in the middle of the sign up process?
You delete the tbl_User_Signup record for the client and the delete cascade deletes the related records in the other five tables.
So u someone help me with some model or some t-sql.
1) SignUp.aspx
2) PhysicalCharacteristics.aspx
3) PersonalityTraits.aspx
4) PersonalDetails.aspx
5) PersonalInterest.aspx
6) Questions.aspx
Now I created the db with the appropriate links.
CREATE TABLE [dbo].[tbl_User_SignUp] (
[UserID] [int] IDENTITY (1, 1) NOT NULL ,
[UserName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[PasswordHash] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Salt] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[HeadLine] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Title] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[FirstName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[LastName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Email] [nvarchar] (75) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[SecretWordType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[SecretWord] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[Age] [int] NOT NULL ,
[DOB] [datetime] NOT NULL ,
[Zodiac] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[GenderID] [int] NOT NULL ,
[City] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[StateProvinceID] [int] NOT NULL ,
[CountryID] [int] NOT NULL ,
[DateCreated] [datetime] NOT NULL ,
[LastLogin] [datetime] NOT NULL ,
[LogCount] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_User_PersonalDetails] (
[UserID] [int] NOT NULL ,
[SexualOrientationID] [int] NOT NULL ,
[DrinkingID] [int] NOT NULL ,
[ReligionID] [int] NOT NULL ,
[SmokingID] [int] NOT NULL ,
[OccupationID] [int] NOT NULL ,
[DrugID] [int] NOT NULL ,
[EducationID] [int] NOT NULL ,
[MaritalStatusID] [int] NOT NULL ,
[IncomeID] [int] NOT NULL ,
[ChildrenID] [int] NOT NULL ,
[RelocateID] [int] NOT NULL ,
[WantChildrenID] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_User_PersonalInterest] (
[UserID] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_User_PersonalityTraits] (
[UserID] [int] NOT NULL ,
[AdaptableID] [int] NOT NULL ,
[AdventurousID] [int] NOT NULL ,
[AffectionateID] [int] NOT NULL ,
[AggressiveID] [int] NOT NULL ,
[AloofID] [int] NOT NULL ,
[AmbitiousID] [int] NOT NULL ,
[ArrogantID] [int] NOT NULL ,
[ArtisticID] [int] NOT NULL ,
[BossyID] [int] NOT NULL ,
[CalmID] [int] NOT NULL ,
[CaringID] [int] NOT NULL ,
[CharmingID] [int] NOT NULL ,
[CleverID] [int] NOT NULL ,
[CompassionateID] [int] NOT NULL ,
[CompetitiveID] [int] NOT NULL ,
[ConfidentID] [int] NOT NULL ,
[CourageousID] [int] NOT NULL ,
[CreativeID] [int] NOT NULL ,
[DeepID] [int] NOT NULL ,
[DisciplinedID] [int] NOT NULL ,
[DIYID] [int] NOT NULL ,
[DominantID] [int] NOT NULL ,
[EfficientID] [int] NOT NULL ,
[EnergeticID] [int] NOT NULL ,
[ExtrovertedID] [int] NOT NULL ,
[FaithfulID] [int] NOT NULL ,
[FlexibleID] [int] NOT NULL ,
[ForgivingID] [int] NOT NULL ,
[FrugalID] [int] NOT NULL ,
[GenerousID] [int] NOT NULL ,
[HonestID] [int] NOT NULL ,
[HumorID] [int] NOT NULL ,
[ImpulsiveID] [int] NOT NULL ,
[IndependentID] [int] NOT NULL ,
[IntellectualID] [int] NOT NULL ,
[IntelligentID] [int] NOT NULL ,
[KindID] [int] NOT NULL ,
[LazyID] [int] NOT NULL ,
[LeaderID] [int] NOT NULL ,
[LovingID] [int] NOT NULL ,
[LoyalID] [int] NOT NULL ,
[ModestID] [int] NOT NULL ,
[MoralID] [int] NOT NULL ,
[NeatID] [int] NOT NULL ,
[OpenMindedID] [int] NOT NULL ,
[OptimisticID] [int] NOT NULL ,
[OrganizedID] [int] NOT NULL ,
[OutspokenID] [int] NOT NULL ,
[OverAchieverID] [int] NOT NULL ,
[PassionateID] [int] NOT NULL ,
[PatientID] [int] NOT NULL ,
[PerfectionistID] [int] NOT NULL ,
[PersistentID] [int] NOT NULL ,
[PunctualID] [int] NOT NULL ,
[ResilientID] [int] NOT NULL ,
[SelfAwareID] [int] NOT NULL ,
[SensitiveID] [int] NOT NULL ,
[SincereID] [int] NOT NULL ,
[SpontaneousID] [int] NOT NULL ,
[StubbornID] [int] NOT NULL ,
[SubmissiveID] [int] NOT NULL ,
[SuccessfulID] [int] NOT NULL ,
[SuperstitiousID] [int] NOT NULL ,
[SupportiveID] [int] NOT NULL ,
[UncomplicatedID] [int] NOT NULL ,
[UnderAchieverID] [int] NOT NULL ,
[UnderstandingID] [int] NOT NULL ,
[VivaciousID] [int] NOT NULL ,
[WarmHeartedID] [int] NOT NULL ,
[WiseID] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_User_PhysicalCharacteristics] (
[UserID] [int] NOT NULL ,
[NationalityID] [int] NOT NULL ,
[EthnicBackgroundID] [int] NOT NULL ,
[AppearanceID] [int] NOT NULL ,
[BodyTypeID] [int] NOT NULL ,
[ComplexionID] [int] NOT NULL ,
[HairStyleID] [int] NOT NULL ,
[HairColorID] [int] NOT NULL ,
[HeightID] [int] NOT NULL ,
[WeightID] [int] NOT NULL ,
[EyeWearID] [int] NOT NULL ,
[EyeColorID] [int] NOT NULL ,
[FacialShapeID] [int] NOT NULL ,
[FacialHairID] [int] NOT NULL ,
[FashionSenseID] [int] NOT NULL ,
[TattooID] [int] NOT NULL ,
[JewelryID] [int] NOT NULL ,
[PiercingID] [int] NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[tbl_User_Questions] (
[UserID] [int] NOT NULL ,
[IPreferToBeWithID] [int] NOT NULL ,
[IfMyLifeWereABookID] [int] NOT NULL ,
[IntentionID] [int] NOT NULL ,
[WhenIThinkAboutMoneyID] [int] NOT NULL ,
[IfMoneyWereNoObjectIdLiveID] [int] NOT NULL ,
[ToProveIAmRomanticID] [int] NOT NULL ,
[PublicDisplaysOfAffectionID] [int] NOT NULL ,
[AsACommunicatorIWouldDescribeMyselfAsID] [int] NOT NULL
) ON [PRIMARY]
GO
January 17, 2004 at 6:07 am
Would have a table say, signup_status with unique UserID and flags to identify whether an entry was made in the respective tables
create table signup_status
(
UserID int NOT NULL PRIMARY KEY ,
SignUp bit NOT NULL DEFAULT 0 ,
PersonalDetails bit NOT NULL DEFAULT 0 ,
PersonalInterest bit NOT NULL DEFAULT 0 ,
PersonalityTraits bit NOT NULL DEFAULT 0 ,
PhysicalCharacteristics bit NOT NULL DEFAULT 0 ,
Questions bit NOT NULL DEFAULT 0
)
create proc spINS_SignUp @params...
as
begin
begin tran
insert into ur signup table
if error rollback n return
else
get the new userid
insert into signup_status (UserId, SignUp)
values (@uid, 1)
if error rollback n return
else
commit tran n return
end
similar proc for other inserts but instead of INSERT INTO signup_status, UPDATE signup_status ... WHERE UserID = @uid
Now when sign-up check if an entry exists in signup_status and what is the last flag field and call the appropricate .asp files
something like this...
HTH
Sachin
Regards,
Sachin Dedhia
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply