The method of ASP connection SQL2000

Source: Internet
Author: User
SQL uses ASP to connect to the MS SQL database, the standard connection, commonly used is the following connection string:
CONN. OPEN "Provider=SQLOLEDB.1;" &_
"Password= '" &pass_word& "';" &_
"Persist security info=true;" &_
"User id= '" &User_ID& "';" &_
"Initial catalog= '" &db& "';" &_
"Data source= '" &Data_Source& "';" &_
"CONNect timeout=" &cntimeout& ""
Describe:
Provider=SQLOLEDB.1 the database provider, the following 1 is the version information, and if not, the current newest feature is fully used
User id=sql account number, Database account number
Password=sql account password, database account password
Initial catalog= Database name (only the name, and access is the specific data file with the path)
Data source, SQL Server name, or its IP, usually with IP source=
The five parameters are indispensable
About Data Source:
If IIS and SQL are the same server, use the IP or host name hostname or (local) that installs IIS
For example:
Data source= (local) ' IIS is the first to choose it with SQL!
Data source=212.100.1.12
Data SOURCE=LSS
If SQL Server is on another machine, such as you connect to SQL Server on my machine, use my machine's IP
Data source=208.190.21.112 ' My SQL Server IP
Connect timeout= connection Timeout, is an integer, the default is 30 seconds, you can not
Persist security info= True or false can be used without

Understand the difference between SQL and access:
Access is a file-type database, a database is a specific MDB file, so access connections need to give specific database path data source= ' C:\www\mdb\aaa.mdb '
and Server.MapPath (Aaa.mdb) is to map Aaa.mdb to C:\www\mdb\aaa.mdb
SQL Server is a S/C client/server approach that is completely different from access, so accessing SQL 2000 databases requires a client-and server-side connection, noting that this client is for SQL database servers
Server-side scripts are also "client applications" for SQL Servers.
The SQL database is also physically a. mdf data file, but this is different from the MDB, and SQL MDF is a collection of databases that contain a number of databases (each of which has a name, each database has a corresponding owner Schma), And the MDB of access is a file is a database.
So access to the SQL database to specify its server IP database account password database name (of course there is no path to say)
Access can be accessed only by accessing the file in Access.
Now it's time to go into Enterprise Manager, build a database (for example, AAA), create a database user and password in the database, and then connect to it with the connection string above!

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.