JavaScript客户端连接数据库
今天突然发现以前少写了一个“\”而已,真正的连接字符串为"Driver={SQL Server};Server=127.0.0.1\\SQLEXPRESS;Database=SJTU;Uid=kissrat;Pwd=kissratpass;"。通过DSN的方式的方法如下:
1、建立系统DSN数据源;
2、最简单的连接字符串"DSN=SJTU;";
3、复杂一点的,支持远程连接"Remote Server=[192.168.0.1]; Remote Provider=MSDASQL;Network Library=DBMSSOCN;DSN=SJTU;";
4、客户端Js代码

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

这里面record其实只是rs("kissrat")的一个引用,所以在rs.Movenext执行之后它就变成了新纪录的引用。rs("kissrat")的类型是个对象,可以简单的rs("kissrat")+""变成字符串,或者再来个toString()。有个经验,就是一定要注意iframe的缓存,父页面刷新它总是停在那儿懒得动,所以要想办法叫醒它。还有两个类型扩展,用得比较多:

这种方法很变态,不能作为任何实际的网络应用,但可以看成是本地的一个应用程序。其实用js等脚本技术来解决一些“私人”问题是非常方便的,尤其像我的电脑,20世纪的,没有联网,没有mssql,没有vc,更没有matlab,能运行word、excel就不错了。不过很好,有记事本,随便写个vbs脚本或这样运行个html js,做些数据库操作、神经网络的模拟实验什么的。windows很好,有记事本、excel可以当数据库,有dsn引擎,不用复杂的字符串操作,有IE,dhtml,不用晦涩的正则表达式,我的任务就可以简单地完成了,要求不高。当然了,要好好研究还是到实验室舒服,机子跑得快,还能天天上网,不过有问题不见得能在网上找到答案,能自己解决一个简单的问题就是一大进步了。

【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步