Method One: (successfully used in the project)
< head >
< title > Rnnews </title >
< BODY >
<%
' strconnection= ' Driver={mysql ODBC 3.51 Driver}; Server={local};D Atabase=gmdb; User=richman; password=qazwsxedc;option=3; "
strconnection = "driver=" + Getini ("dbconnectstring", "DSN", Server.MapPath ("Ip.ini")) + "; Server= "+ Getini (" dbconnectstring "," Server ", Server.MapPath (" Ip.ini ")) +";D atabase= "+ Getini (" Dbconnect String "," Database ", Server.MapPath (" Ip.ini ")) +"; User= "+ Getini (" dbconnectstring "," User ", Server.MapPath (" Ip.ini ")) +"; Password= "+ Getini (" dbconnectstring "," Password ", Server.MapPath (" Ip.ini ")) +"; option= "+ Getini (" Dbconne Ctstring "," option ", Server.MapPath (" Ip.ini "))
' Response.Write strconnection
' Response.End
Set conn = Server.CreateObject ("Adodb.connection")
Conn.Open strconnection
sql = "SELECT * from News where newsflag=1 order by NewsID desc" ' SQL query statement
Set rs = conn.execute (SQL)
If not Rs.bof then
% >
<%
' Do, not rs.eof
Function Getini (Strprimary,strsubkey,strinifilepath)
Set Myfso = Server.CreateObject ("Scripting.FileSystemObject")
Set MyFile = Myfso.opentextfile (Strinifilepath)
Dim intcount
Dim strstate
Do Until Myfile.atendofstream
If intcount = 0 Then
If Myfile.readline = "[" & Strprimary & "]" Then
intcount = 1
End If
Else
Strstate = Myfile.readline
If UCase (left (strstate, Len (strSubKey & =)) = UCase (strSubKey & "=") Then
Getini = Right (Strstate, Len (strstate)-Len (strSubKey & "="))
End If
End If
Loop
Myfile.close
Set MyFile = Nothing
Set Myfso = Nothing
End Function
% >
< p >
<% = RS ("newscontent")% >
</p >
<%
' Rs.movenext
' Loop