asp 取数据库内容

asp 取数据库内容,第1张

改成:

<%

sql1="select from [notice] where id order by id desc"

rsopen sql1,conn,1,1

if not rseof and not rsbof then

rspagesize=10

rsabsolutepage=1

for i=1 to rspagesize

if rseof then

exit for

end if

%>

<p><%=rs("title")%>

<%

rsmovenext

next

end if

%>

Sqlserver数据库可以采用:ADONET才获取数据库中的值:

public string GetPhoneByUserName(string UserName)

{

SqlConnection conn = new SqlConnection("Server=;database=数据库名;uid=sa;pwd=");

connOpen();

SqlCommand comm=new SqlCommand(conn,"select phonenumber from 表名 where UserName=‘"+UserName+"'");

return commExcuteReader();

}

然后在页面后台代码中:thisTextBoxText=GetPhoneByUserName(Session["UserName"]ToString());

你这是语法错误,看你的语句hao应该是一个变量,而不是数据库表里面的字段。如果num是字段应该这样写:

strSql="select from phone where num='"& hao&"'"

以上就是关于asp 取数据库内容全部的内容,包括:asp 取数据库内容、asp.net如何提取数据库中的值、ASP读取数据库等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/10058214.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-04
下一篇2023-05-04

发表评论

登录后才能评论

评论列表(0条)

    保存