First, you must modify your code.
Code connectstring = "filedsn = student. DSN; uid = sa; Pwd = 123456"
Change to connectstring = "provider = sqloledb; server192.168.26.61; uid = sa; Pwd = 123456; Data = student"
If not, change to connectstring = "provider = sqloledb; datasource = 192.168.26.61; uid = sa; Pwd = 123456; database = student"
Provider = sqloledb: you are using the SQL Server database.
Server = 192.168.26.61: IP address of the database server.
Uid = sa; Pwd = 123456: the login method used by the SQL Server database is SQL Server Authentication Mode User name: SA; Password: 123456.
Database = Student: student database is used.
Set remote access for SQL Server
SQL Server 2008 does not allow remote connection by default. The SA account is disabled by default.
Server 2008 requires two configurations:
1. SQL servermanagement studio Express (SSMs)
2. SQL Server Configuration Manager/sqlserver
Configuration Manager (sscm)
Step 1: Open SSMs and connect to the database as a Windows user. After logging on, right-click and select "properties"
Step 2: Select "security" on the left and select "SQL Server" and"
Windows Authentication Mode "to enable mixed logon Mode
Step 3: Select "connection", select "allow remote connection to this server", and click "OK"
Step 4: Expand "security"-> "Login Name"-> "sa", right-click and select "properties"
Step 5: Select "regular" on the left side, select "sqlserver authentication" on the right side, and set the password
Step 6: Select "status", select "enable", and click "OK"
Step 7: Right-click the database and select "aspect"
Step 8: Set "remoteaccessenabled" to "true" and click "OK"
Step 9: Now that SSMs has been set up, log out first and log on with SA. If it succeeds, the SA account is enabled.
Step 10: Configure sscm and open the Configuration Manager in the configuration tool.
Step 11: Click Connect
Step 12: select the Web Service URL and then select Advanced
Step 13: click Add. The add window is displayed. Select your own IP address, change the TCP port to 1433, and click OK.
Step 14: The configuration is complete ,.
At this point, you should be able to use it, but check the firewall.
After SQL server2005/2008 Express is installed, remote connection is disabled by default. If you need remote access, you need to configure it manually.
Enable Firewall settings. Add sqlservr.exe (c: \ Program Files \ microsoft sqlserver \ mssql10.sqlexpress \ MSSQL \ binn \ sqlservr.exe) to the allowed list.
If there is something different, see http://jingyan.baidu.com/article/6c67b1d6ca06f02787bb1ed1.html