Simple ASP+MSSQL Server Message board System

Source: Internet
Author: User
Tags mssql mssql server

Sub Opensql ()
Set Sqlrs=server. CreateObject ("Adodb.recordset")
Set Sqlcn=server.createobject ("Adodb.connection")
Sqlconstr= "Driver={sql server};server=xiewen;uid=sa;pwd=123456;database=jimmy"
Sqlcn.open Sqlconstr
End Sub

Feature handler ASP tutorial save content to Database

<%dim F_id,tag,names,lytxt
F_id=request. QueryString ("id")
Tag=request. QueryString ("tag")
Lytxt=html_encode (Request. Form ("Lytxt"))
Names=session ("Lyname")
If names= "" Then
names= "Anonymous"
End If
if (not IsNumeric (f_id)) or (not IsNumeric (tag)) or Len (lytxt) <5 Then
Response. Write (' <script language= ' javascript tutorial ' >alert (' article content cannot be less than five characters! '); History.back ();</script> ")
Else
Sql= "SELECT * FROM Guestbook"
On Error Resume Next
Call Opensql ()
Sqlrs.open sql,sqlcn,1,3
Sqlrs.addnew
Sqlrs ("ly") =lytxt
Sqlrs ("f_id") =f_id
Sqlrs ("tag") =tag
Sqlrs ("name") =names
Sqlrs.update
If Err=0 Then
Response. Redirect ("list.asp?id=" &f_id& "&tag=" &tag)
Else
Response. Write ("<script language= ' JavaScript" >alert (' very sorry, your message failed! '); History.back ();</script> ")
End If
End If


%>

HTML Provision page

<input name=lytxt >

<input Type=submit Value submitted/>

Original reprint of this site annotated www.111cn.net

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.