Simple ASP+MSSQL Server Message board System

Source: Internet
Author: User
Tags mssql mssql server

Database Tutorial Connection Program

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
& Nbsp;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/>


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.