In the example of ewebeditor, there is a news publishing system. Let's take it as an example to illustrate how ewebeditor connects to the database.
Database-related functions are defined in startup. asp, including sub dbconnbegin (), sub dbconnend (), and other methods for enabling and disabling database connections.
Then all other. asp files are passed <! -- # Include file = "startup. asp" --> to declare that the ". asp" file can directly call the methods declared by startup. asp.
In add_save.asp
Strsql = "select * From news_info where 1 <> 1" <br/> set Cn = opendatabase (connstr) <br/> set rs = server. createobject ("ADODB. recordset ")
The "connstr" connection string is defined in conn. asp.
This indicates that the ewebeditor can connect to the database separately. You can use the independent conn. asp to determine which database to connect to without modifying the content of the ewebeditor.
"Connstr" is defined
sqlserver = "computername/sqlexpress" <br/>' if it is SQL Server 2005, it is "Weste/sql2005" <br/> 'if it is SQL Server Express, it is "Weste/sqlexpress" <br/>' the computer name can also be used". "Replace <br/> sqluser =" sa "'database login name <br/> sqlpass =" sa12345 "'database password <br/> sqldata =" Database "'database name </ p> <p> connstr = "provider = sqlncli; data Source = "& sqlserver &"; uid = "& sqluser &"; Pwd = "& sqlpass &"; database = "& sqldata &" "<br/>