ASP.NET Guestbook
(Page 1 of 8 )
We are going to see the steps involved in designing a guestbook using ASP.NET and SQLServer as the backend. Guestbooks are an important tool to know about your site’s visitors and their opinions. I would like to give you an idea of a basic guestbook web application in this article.
Requisites:
1) Windows 2000 or Windows XP or Windows 2003
2) Microsoft SQL Server 7.0 or 2000
3) Internet Information Server
4) Knowledge about VB.NET.
5) Basics in SQL
Pages in this Project:
1) postcomments.aspx
2) viewcomments.aspx
We need a database to save the posted comments. The database can be anything from a simple text file to a sophisticated database engine. In this article I’ve used SQL Server 2000 (MSDE).
Warning: Do not use the below script on a production database server. Use it on a SQL server that does not contain any sensitive data.
Sql Script
:
filename='d:guestguestD.mdf')
log on
(name='guestLog',
filename='d:guestguestL.ldf')
go
use guestbook
use guestbook
exec sp_grantDBaccess 'YourDomainNameaspnet' /*domain name might be your computer name */
exec sp_addsrvrolemember 'YourDomaiNameaspnet','dbcreator'
exec sp_helpuser
filename='d:guestguestD.mdf')
log on
(name='guestLog',
filename='d:guestguestL.ldf')
go
use guestbook
use guestbook
exec sp_grantDBaccess 'YourDomainNameaspnet' /*domain name might be your computer name */
exec sp_addsrvrolemember 'YourDomaiNameaspnet','dbcreator'
exec sp_helpuser
go
create table feedback(id int primary key identity(1,1),name varchar(50)not null ,email varchar(200)not null,comments varchar(1000)not null,rating int not null) --create table
select * from feedback -- display the empty table
go
/* sample feedbacks */
insert into feedback values('Abhiram','rabhiramvikrant@sify.com','I like this site very much.It was not flashy , but informative',3)
insert into feedback values('Samu','samusundar@sify.com','I don''t think this site is worth a visit',1)
insert into feedback values('Kannan','kannan@sify.com','Exactly what are you trying to say?',0)
insert into feedback values('Anand','anand@sify.com','Na! this site is a crap',1)
insert into feedback values('Lancer','lancer@somedomain.com','cool site buddy',3)
go
select * from feedback -- display the populated table
go
select count(*) from feedback -- Number of records in the table
go
--Note:Bold letters represents comments
Next: Viewing the Results >>
More ASP.NET Code Articles
More By R. Abhiram Vikrant