I got this system (student management system). The first thing is to create a database, open the database --- file -- open -- Student
Load ---- execute it. The database is created! Self-built tables will be studied in the future ......
Method 1 for database data connection --------- filedsn
Filedsn is used for data source connection. You have configured it yourself,
Management Tool ---------- data source (ODBC)
Second: PassSQL oledb connection method
Public Function ConnectString() As StringConnectString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student;Data Source=lishehe-pc"End Function
Third: the relationship between oledb, ADO, and ADOX:
ODBC:Previous Database Communication Standards
Oledb:Under the trend of all objectiveness, Ms intends to use it to replace ODBC.
OledbThere are two types: Direct oledb and ODBC-oriented oledb. The latter architecture is on ODBC.
The characteristics of oledb can also be used for databases without their own oledb providers.
ADO:It is actually an application-level interface, which uses oledb to communicate with databases.
ADOX:Extends the Security and maintainability of ADO (for example, creating a database.
2. Use ODBC to connect to the database:
ODBC provides three kinds of DSN, the difference is very simple: User DSN can only be used for this user. The difference between the system DSN and the file DSN is that the storage location of the connection information is different: the system DSN is stored in the ODBC storage area, and the file DSN is placed in a text file.
Their creation methods will not be mentioned.
When using them in ASP, the statement is as follows:
A. SQL Server: Use system DSN: connstr = "DSN = dsnname; uid = xx; Pwd = xxx; database = dbname" Use File DSN: connstr = "filedsn = xx; uid = xx; Pwd = xxx; database = dbname "you can also use a connection string (to avoid creating a DSN): connstr =" driver = {SQL Server}; server = servername; uid = xx; Pwd = xxx "B. access: Use system DSN: connstr = "DSN = dsnname" (or: connstr = "DSN = dsnname; uid = xx; Pwd = xxx") with file DSN: connstr = "filedsn = xx" you can also use a connection string (so that you do not need to create a DSN): connstr = "driver = {Microsoft Access driver}; DBQ = D: abcabc. mdb"
3. Use oledb to connect to the database:
A.sql server: connstr= "PROVIDER=SQLOLEDB; DATA SOURCE=servername;UID=xx;PWD=xxx;DATABASE=dbname " B.access: connstr= "PROVICER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=c:abcabc.mdb "