Recommended: How to assign values to data table entity classes in .net I encountered a problem today, which is how to assign values to attributes in the data entity class. Because the DataSet is taken out from the database. It is very clumsy to assign values to attributes in the data entity class one by one, and our data tables have as many as 24. Searched online and wrote
1. Connect ACCESS: conn.open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= & Server.mappath(/db/database.mdb)
This method of using the relative path of the root directory can solve the problem of sharing a conn.asp file in the entire website, but be aware that this method is not suitable for sites under the virtual directory during local debugging.
2. Connect SQL SERVER: cnn.open Provider=SQLOLEDB;Data Source=127.0.0.1;Initial Catalog=db;User ID=USER;Password=PWD;
3. If it is an ACCESS database, it is best to place it in a folder outside the website directory to prevent downloading. This method is most suitable for virtual host websites. The program is placed in the WWW folder and the database is placed in the DATABASE folder.
4. If you cannot connect with DSN or put it in a folder outside the website, it is recommended to enable complex names and add # characters to the database, which will better prevent downloads. In addition, changing .mdb to .asp is not safe, so it is easy to execute the submission of asp code. The recommended file name is: *#*.mdb
5. The safest way: After all the websites are completed, add On Error Resume Next to the first line in the conn.asp file
Share: ASP implements the principles and simple examples of thief program (I) Principle: The thief program actually calls web pages on other websites through the XMLHTTP component in XML. For example, in the news thief program, many of them call Sina's news pages, and some replacements are made to the html in it, and the advertisements are also filtered.