Preparation of simple message board of asp + version (2)

Source: Internet
Author: User

Http://www.asp888.net bean curd technology station

After entering the message, you must enter the message content. One of the key points is
How can we read the content in config. web? I used the following statements:
Dim Cfg as HashTable
Cfg = Context. GetConfig ("etettings ")
Conn = New SQLConnection (cfg ("Conn "))
In this way, we get the connection string we set in config. web. The program is as follows:
<% @ Import Namespace = "System. Data" %>
<% @ Import Namespace = "System. Data. SQL" %>
<Script runat = "server" language = "VB">
Sub Page_Load (Src As Object, E As EventArgs)

Dim conn As SQLConnection
Dim Cfg as HashTable
Cfg = Context. GetConfig ("etettings ")
Conn = New SQLConnection (cfg ("Conn "))
Dim strSQL as string
Dim strNickName as string
Dim strMail as string
Dim strTitle as string
Dim strContent as string
Dim strIPAddr as string
StrNickName = replace (request. form ("txtName "),"","")
StrEmail = replace (request. form ("txtMail "),"","")
StrTitle = replace (request. form ("txtTitle "),"","")
StrContent = replace (request. form ("txtContent "),"","")
StrIPAddr = Request. ServerVariables ("REMOTE_ADDR") user IP Address
StrSQL = "insert into msgBoard (nickname, email, ipAddr, msgTime, msgTitle, msgContent) values ("
StrSQL = strSQL & "" & strNickName & "," & strEMail & "," & strIPAddr & ", getdate ()," & strTitle & "," & strContent &")"
Response. write (strSQL)
Dim Cmd As SQLCommand
Cmd = New SQLCommand (strSQL, conn)
Cmd. ActiveConnection. Open ()
Cmd. Execute ()
Cmd. ActiveConnection. Close ()
Response. Redirect ("showmsg. aspx ")
End sub
</Script>
As a matter of fact, we can see that this program is actually no different from the asp program. By the way, the only benefit of following MS is that they are upgrading.
They always have good compatibility with their previous systems, except for the many changes in database operations caused by the reference of ado.net.
There are basically no major changes to the Code. If it is too bad to say, I am making a mistake here. It's not that there are no major changes, but the changes are great.
Previously compatible, and our simple applications do not seem to involve any complicated changes :)


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.