ASP with the database when dealing with some of the problems that may be encountered!

Source: Internet
Author: User
Tags dsn insert sql new features window access
Data | database | Question: Why is the RecordCount value of my Recordset always returning-1?

A: You should use this mode to open the recordset that accesses the database:

Rs.Open strsql,conn,1,1

The strSQL is the SQL statement that operates the database; conn is the connection variable that joins the database.


Q: I wrote a lot of comments in the ASP script that will not affect the speed at which the server processes ASP files
Degree?

A: After testing by foreign technicians, the overall performance of ASP files with too many annotations will only drop by 0.1%, which means that the performance of the server will not be affected.


Q: Do I need to use <% @LANGUAGE =vbscript%&gt at the beginning of each ASP file??

A: If you use a scripting language that is VBScript, try not to use this statement, otherwise the overall performance of the program will drop by nearly 1.2%, but if you are not using the VBScript language, please use this statement.


Q: Is it necessary for me to use option Explicit in every ASP file?

A: You'd better do this because it will minimize the chance of your program error and improve overall performance by nearly 9.8%


Q: What are the new features of the ASP3.0 that appeared with IIS5.0 recently?

A: There is no new change, but the new method of adding two server objects:
Server.Transfer and Server.excute, there is also a new object asperror. Please refer to Microsoft's website for specific usage: www.microsoft.com


Q: Why did I get an error when I used Response.Redirect?

A: The most common reason is that you modify the HTTP title after you write the page, and the solution is to write the page at the beginning of the <%Response.Buffer=True%>


Q: It seems that the redirect method can only be redirected to the same frame, could it be directed to other frames?

A: Yes, I'd like to add this:. Then, when you re using
When you redirect the method, you redirect it to the frame named FrameName.


Q: Why do I use the "window.open ()" method to open a new window in an ASP page that often appears
Session loss phenomenon?

A: This is often the case in Microsoft's ie4.x, but ie5.x has solved the error. Therefore, in order to be compatible with all browsers, you can use such "test.asp?name=xxx" way to pass parameters between windows, which is better, just note that if the parameters passed are important, do not use plaintext to pass, otherwise it is easy to cause security problems.


Q: It's often seen that there are two ways to connect a database DSN and dsn-less, what do they mean? What's the difference?

A: DSN is the English "data source Name" abbreviation, DSN is the way to use the data source of the join, this data source can be in the "Control Panel" in the "ODBC data Sources" in the set, and then use:

Conn.Open "Dsn=test; Uid=admin; pwd=; "

The "Test" is the name of the data source you set yourself. Note that you can use both the UID and the PWD, otherwise there will be an error.

Similarly, dsn-less is a non-data source method of joining, using the following methods:

Conn.Open "Driver={microsoft Access Driver
(*.mdb)};D Bq=\somepath\mydb.mdb; Uid=admin; pwd=; "

In the same hardware environment, the dsn-less mode is higher than the performance of DSN, but once the ASP source code for some security problems by others, will leak the database account and password, so the two ways is a pros and cons.


Q: Is there a difference between using the AddNew method of ADO in ASP and using the "Insert into ..." statement directly?
That's a better way?

A: ADO's AddNew method only encapsulates "Insert into" statement, so when manipulating large amounts of data, direct use of SQL statements will greatly speed up access to data because he reduces the "translation" Time of ADO. Although SQL statements are not as easy to accept as AddNew, it is important to learn some common SQL statements in database programming.


Q: Why do I take this sentence ("Let's Go now!" An error occurs when inserting into the database?

A: Since most databases (Access,ms SQL Server) use single quotes as split symbols, you cannot insert single quotes directly into the database, you must replace each single quotation mark with two single quotes before executing the SQL statement:

Mydata=replace (MyData, "" "," "" "", 1) then, save it to the database.



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.