就是不知道怎么弄后台
[upload=jpg]http://photoimg25./cgi-bin/load_pic?verify=vT6U9MoXynkBTcBju8jL2Q%3D%3D[/upload]
[此贴子已经被作者于2005-12-27 5:37:05编辑过]
已成功连接数据库!
<%
var Recordset1_cmd = Server.CreateObject ("ADODB.Command");
Recordset1_cmd.ActiveConnection = "dsn=jsconn;"; '用的系统DSN
Recordset1_cmd.CommandText = "SELECT * FROM book";
Recordset1_cmd.Prepared = true;
var Recordset1 = Recordset1_cmd.Execute();
var Recordset1_numRows = 0;
%>
就是不知“自定义连接字符串”该怎么写?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www. <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>js与sql</title> <script type="text/javascript"> var conn, rs; function InitDB() { conn = null; rs = null; conn = new ActiveXObject("ADODB.Connection"); rs = new ActiveXObject("ADODB.Recordset"); constr = "Driver={SQL SERVER};Server=(local);Database=xxx;UID=sa;PWD=xxx"; } function testdb() { conn.Open(constr); sqlstr = "select * from users"; rs.open(sqlstr, conn); for(i=0;i<20;i++){ document.write(rs(i)+' '); } rs.close(); conn.close(); } </script> </head> <body onload="InitDB()"> <form id="form1" runat="server"> <input type="button" value="submit" onclick="testdb()"> </body> </html>