日期:2014-05-16  浏览次数:20447 次

asp下链接数据库的各种语句
		<% 
			Response.Write "test" 
			Dim db                                      
			Set db=Server.CreateObject("ADODB.Connection") 
			'db.Open "Dbq=C:\Inetpub\wwwroot\wwwlink.mdb; Driver={Microsoft Access Driver (*.mdb)}"
			'db.Open "Dbq=C:\Inetpub\db\wwwlink.mdb; Driver={Microsoft Access Driver (*.mdb)}"
			'db.Open "Dbq=C:\db\wwwlink.mdb; Driver={Microsoft Access Driver (*.mdb)}"
			'db.Open "Dbq=" & Server.Mappath("wwwlink.mdb") & ";Driver={Microsoft Access Driver (*.mdb)}" 
			Dim conStr
			conStr="Driver={SQL Server}; Server=(local);UID=admin;PWD=000000;DATABASE=web;"
			db.open conStr 
			Dim sqlStr,rs
			sqlStr="select * from webInfo"
			set rs = db.Execute(sqlStr)
		%>
		<table border="1px">
			<%
				Do While Not rs.Eof
			%>
			<tr>
				<td><a href="sqlDelete.asp?id=<%=rs("link_id")%>">删除</a></td>
				<td><a href="sqlEdit.asp?id=<%=rs("link_id")%>">编辑</a></td>
				<td> <%=rs("name")%></td>
				<td> <%=rs("url")%></td>
				<td> <%=rs("intro")%></td>
			</tr>
			<%
				rs.MoveNext
				Loop
			%>
		</table>

?防止遗忘,特写博客