无法在数据库中建立password字段的表(SQL那行,把password字段删了才可以)
<%@language="vbscript"codepage="65001"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transi...
<%@language="vbscript" codepage="65001"%>
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transtional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html/html;charset=utf-8"/>
</head>
<body>
<p>你的Web服务器正在工作。Your Web server is working.<br/></p>
<%
MySelf=server.mappath("./")&"/userinfo.mdb"
'创建一个FileSystemObject对象实例
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
If MyFileObject.FileExists(MySelf) Then
Response.Write("数据库文件已存在!<br/>")
Else
Set Catalog_object=Server.CreateObject("ADOX.Catalog")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("userinfo.mdb")
Catalog_object.Create(connstr)
Set Catalog_object=Nothing
Response.Write("1.创建数据库文件userinfo.mdb成功<br/>")
set conn=server.CreateObject("adodb.connection")
'连接MS Access
conn.Open connstr
If conn.state=1 Then
response.write("2.数据库连接成功<br/>")
On Error Resume Next
table_name="users" '获取上页传过来的表名
SQL = "CREATE TABLE "&table_name&"(id counter, username varchar(20),password varchar(12),sex varchar(6),qq varchar(20),mail varchar(20),ntime varchar(20))"
conn.Execute SQL
if err.Number<>0 then
Response.Write "出错! 错误信息:"&err.description&""
else
Response.Write "建表info成功!id username password sex qq mail ntime"
end if
Else
response.write("2.数据库连接失败<br/>")
End If
End If
response.write("<br/>你的测试时间是:"&Now())
%>
</body>
</html> 展开
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transtional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html/html;charset=utf-8"/>
</head>
<body>
<p>你的Web服务器正在工作。Your Web server is working.<br/></p>
<%
MySelf=server.mappath("./")&"/userinfo.mdb"
'创建一个FileSystemObject对象实例
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
If MyFileObject.FileExists(MySelf) Then
Response.Write("数据库文件已存在!<br/>")
Else
Set Catalog_object=Server.CreateObject("ADOX.Catalog")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("userinfo.mdb")
Catalog_object.Create(connstr)
Set Catalog_object=Nothing
Response.Write("1.创建数据库文件userinfo.mdb成功<br/>")
set conn=server.CreateObject("adodb.connection")
'连接MS Access
conn.Open connstr
If conn.state=1 Then
response.write("2.数据库连接成功<br/>")
On Error Resume Next
table_name="users" '获取上页传过来的表名
SQL = "CREATE TABLE "&table_name&"(id counter, username varchar(20),password varchar(12),sex varchar(6),qq varchar(20),mail varchar(20),ntime varchar(20))"
conn.Execute SQL
if err.Number<>0 then
Response.Write "出错! 错误信息:"&err.description&""
else
Response.Write "建表info成功!id username password sex qq mail ntime"
end if
Else
response.write("2.数据库连接失败<br/>")
End If
End If
response.write("<br/>你的测试时间是:"&Now())
%>
</body>
</html> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询