服务器标签格式不正确 [英] The server tag is not well form

查看:71
本文介绍了服务器标签格式不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<asp:SqlDataSource ID="SqlDataSource2" runat="server"

            ConnectionString="Data Source=xxx;Initial Catalog=dbxx;Integrated Security=True"

            SelectCommand="SELECT dName,dRegno,dGender,dSpeciality,dExperience,dLanguages FROM Doctor WHERE dName='"&txbxDoctorNameVal.Text&"'">
</asp:SqlDataSource>





我需要从文本框中获取名称,并且匹配的行必须显示在gridview中....
我写了这个,但是发生了一个错误:服务器标签格式不正确".
如果有人知道我的代码有什么问题告诉我..

thanx





i need to get name from text box and the matching rows must show in a gridview....
i wrote this but an error occured "The server tag is not well form"..
if any one knw what is the wrong with my code tell me..

thanx

推荐答案

您可以使用以下方式.
You can use the below way.
<asp:sqldatasource id="SqlDataSource2" runat="server" xmlns:asp="#unknown">
ConnectionString="Data Source=xxx;Initial Catalog=dbxx;Integrated Security=True"
SelectCommand="SELECT dName,dRegno,dGender,dSpeciality,dExperience,dLanguages FROM Doctor WHERE dName=@dName">
  <selectparameters>
    <asp:controlparameter controlid="txbxDoctorNameVal" name="dName" propertyname="Text" />
  </selectparameters>
</asp:sqldatasource>



进一步阅读
在SqlDataSource中使用参数化查询 [ ^ ]
使用SqlDataSource插入,更新和删除数据 [ ^ ]
动态地将参数分配给SqlDataSource参数集合 [



Further reading
Using Parameterized Queries with the SqlDataSource[^]
Inserting, Updating, and Deleting Data with the SqlDataSource[^]
Dynamically Assign Parameter to SqlDataSource Parameter Collection[^]


这篇关于服务器标签格式不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆