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 :)