Connection between VB and SQL Server

Source: Internet
Author: User

When I knocked on the student information management system, I found a problem. In fact, this problem should be summarized during the five examples, but it was also confused and hard to understand. Now I finally understand it.

In the student information management system, the connection statement with SQL Server is:

 
Connectstring = "filedsn = maid. DSN; uid = sa; Pwd = 123456" connectstring = "provider = sqloledb; server = 192.168.24.140; uid = sa; Pwd = 123456; database = student"
 
Connectstring = "filedsn = studentinfo. DSN ;"

 

In the first statement, when connecting VB to the database, you need to create a file DSN as follows:

Open Control Panel-Administrative Tools-Data Source (ODBC)-file DSN-add.

One step


If you enter the logon ID and password for SQL Server Authentication. The connection statement should be:

 
Connectstring = "provider = sqloledb; server = 192.168.24.140; uid = SAS; Pwd = 123456; database = student"

If the window of the network login ID is used, the connection statement is:

 
Connectstring = "filedsn = studentinfo. DSN ;"
 

 


Of course, VB and SQL server can also be remotely connected. In this process, you do not need to create an ODBC data source, which is identified by IP address. The connection statement is:

 
Connectstring = "provider = sqloledb; server = 192.168.24.140 (this is an IP address); uid = sa; Pwd = 123456; database = student (Database Name )"

In this way, when you use a LAN, you can also connect to the peer database through this method, which is easy to manage.




 

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.