Answers.com

This website allows members to post questions and answers on different topics. It resembles Yahoo answers website.

This application uses ASP.NET pages for presentation. ObjectDataSource is used to get data from Data Access Layer (DAL). Stored procedures are used to perform all important operations related to database in SQL Server.

The following are major activities in this application

Technologies and Products Used

Steps to download, deploy and run this project

The following are the steps to related to be taken to run this application. This project makes use of membership feature of ASP.NET. So,we have to configure the website using ASP.NET Configuration tool as explained below.
  1. Download answers.rar and unzip it into any directory in your system. For example, if you extract to c:\ then it will create a directory c:\answers. The download contains all ASP.NET pages but it has NO DATABASE. We have to create database objects using ASP.NET configuration tool manually.
  2. Open Visual Studio.NET 2008 or Visual Web Developer 2008.
  3. Open the project from the directory into which you extracted project.For example, c:\answers
  4. Select Website->ASP.NET Configuration option
  5. Select Security tab
  6. Select Use the security Setup Wizard to configure security step by step.
  7. Select From Internet option in Step 2
  8. Click on Next button in the remaining screens and finally click on Finish.
  9. It create a database called ASPNETDB.MDF with required tables and other database components
  10. Open the database in Server explorer or Database Explorer and create tables using the following script. Use New Query to open query window and type the following commands in SQL Pane.
    create table categories
    (  catcode  varchar(10)  primary key,
       catname varchar(50),
       catdesc  varchar(200),
       noquestions int
    )
    
    create table questions
    (   qid   int   identity primary key,
        title  varchar(100),
        question varchar(2000),
        addedon  datetime,
        catcode  varchar(10)  references categories(catcode),
        userid     uniqueidentifier  references aspnet_users(userid)
    )          
    
    create table answers
    (   aid   int   identity primary key,
        qid   int  references questions(qid),
        answer varchar(2000),
        addedon  datetime,
        userid     uniqueidentifier  references aspnet_users(userid)
    )
    
    
    insert into categories values('music','Music','Songs , Albums etc.')
    insert into categories values('sports','Sports and Games','Sports and Games')
    insert into categories values('health','Health and diet','Health, diet and excercise')
     
  11. Create the following stored procedure in the database.

    CREATE PROCEDURE dbo.AddQuestion(@userid UniqueIdentifier, @title varchar(100),@question varchar(2000), @catcode varchar(10))
    AS
    	begin tran
    	    insert into questions (title,question, catcode,addedon, userid)
    	       values(@title,@question, @catcode, getdate(), @userid);
    	       
    	    update categories  set noquestions = noquestions + 1 
    	    where catcode = @catcode;
    	    
        commit tran
       
    
    CREATE PROCEDURE dbo.GetAllCategories
    AS
       select * from categories
       order by catname
       
       
    CREATE PROCEDURE dbo.GetAnswers(@qid int)
    AS
          select aid,answer, addedon, username, a.userid
    	 from answers a inner join aspnet_users  u on ( a.userid = u.userid)
          where  qid = @qid
          order by  aid desc 
          
          
    CREATE PROCEDURE dbo.GetQuestionDetails
    (@qid int)
    
    AS
    	 select qid,title,question, c.catcode, catname, addedon, username, q.userid
    	 from questions q inner join categories c on ( c.catcode  = q.catcode)
    	 inner join aspnet_users  u on ( q.userid = u.userid)
          where  qid = @qid
          
          
    CREATE PROCEDURE dbo.GetRecentQuestions
    AS
     select top 10 qid, c.catcode,catname,title,addedon 
     from  questions  q inner join categories c
     on  (q.catcode = c.catcode)
     order by  qid desc
    
    
    CREATE PROCEDURE dbo.SearchQuestions
    	(@pattern varchar(100)	)
    
    AS
     select qid, c.catcode,catname,title,addedon 
     from  questions  q inner join categories c
     on  (q.catcode = c.catcode)
     where  title like '%' + @pattern + '%'  or question like '%' + @pattern + '%'
     order by  qid desc
                   
    
    CREATE PROCEDURE dbo.AddAnswer
    	( @qid int, @userid uniqueidentifier, @answer varchar(2000))
    AS
     
        insert into answers (qid,userid,answer,addedon)
          values(  @qid,@userid,@answer, getdate())
    
  12. Goto Solution Explorer and make login.aspx the startup page.
  13. Run project from Visual Studio.NET 2008 or Visual Web Developer 2008.
  14. You should see login.aspx page.