Connecting a database generally takes a string connection. The method of obtaining this string uses "secret cannot be said", that is, any new TXT file, renamed to. X.udl. Then double-click the file, and the Database Connection Properties window appears. The first tab "provider" lists all database engines, Access, SQL Server, Oracle, etc., select the next step to jump to the second tab "Connection", select the Server Name field can fill in the server's IP address, the machine will not fill or fill in the dot number You can select a database by filling in the database user name and password. Click the "Test Connection" button to succeed. Are you sure. Open x.udl with Notepad. You will see the connection string it generates. As follows:
"Provider=SQLOLEDB.1; Persist Security Info=false; User Id=sa; Password=123;initial Catalog=cfdata "
In this connection string, the Persist Security info property is true to indicate that the password is still saved after the connection is established and generally false. The ID and Password properties will only be available if you check "Allow Save password" in the Database Properties dialog box above. You can add them manually. Cfdata is the name of my database.