When developing a student information management system, the most important thing is to connect to the database.
After you have completed the vbprogram, you must first install the database. After the installation is complete, there will be several applications. Based on SQL
Server versions are different. In SQL 2000, the Enterprise Manager event probe queries analyzer and so on.
The 2008 types are SQL Server Management studio.
Database login. When you open sqlserver management studio, there are two login methods:
Your database, or the so-called server, is used for Windows authentication.
In this case, only local users in the local user and domain user can use it. Therefore, it is generally not used.
When logging on to the database for the first time, enter the database as a Windows Authentication identity, and then set the database login name, called the database role.
Is also called a super administrator. You can also create your own database account. Set your login Login name and password.
Configure the login attributes and server roles of the account you set.
Ensure that you have the SysAdmin privilege. Otherwise, you cannot create a database as your identity.
Allow external database connection.
Then, open the SQL file and execute the generated database.
Now that the database has been generated, configure the data source. Open Control Panel-Administrative Tools-ODBC Data Source Management Program.
Enter the name of the data source, which corresponds to the connection in the VB program.
In this location, the connected database can also be directly written
IP address. In this way, you can connect to a database server that is not your computer. Of course, the other party must agree to enter.
Filedsn = data source file name. Uid = database login name. Pwd = database login password.
Note: The database login name is not the user name in the student information management system.
Code for connecting to the data source in VB. There are three connection methods.
ConnectString ="FileDSN=student.dsn;UID=sa;PWD=123"ConnectString = "provider=sqloledb;server=192.168.24.225;UID=sa;PWD=123;database=student"ConnectString ="FileDSN=student.dsn;UID=sa;PWD=123;server=192.168.24.225;persist securityinfo=false"
In short, no matter which connection is used. Your connection statement in the database must specify your data source file. And your database login name and password. Otherwise, the database cannot be connected.
Of course, if you are using Windows authentication, you only need to specify the data source file.