asp.net页面无法获得数据库的值
数据库能连接,如果不加where条件txtKeyword.Text 可以显示“keyWords”值,但加上where由文本框输入的条件就不能得到数据库的值了,为什么呢?
protected void txtProperTitle_TextChanged(object sender, EventArgs e)
{
string strConn = " Server=xiao\\SQLEXPRESS;Initial Catalog=catalogue;User ID=sa;Password=123";
SqlConnection cn = new SqlConnection(strConn);
string SqlString = "select keyWords from dbo.cat where name="+txtProperTitle.Text;
try
{
cn.Open();
SqlCommand objCommand = new SqlCommand(SqlString, cn);
SqlDataReader objReader = objCommand.ExecuteReader();
while (objReader.Read())
{
txtKeyword.Text = objReader.GetString(0);
}
cn.Close();
}
catch (Exception e2)
{
 
相关问答:
asp下面,当要根据不同的权限显示一些功能按钮的话会写成
<%
if 权限=1 then
%>
<input type="submit" name="Submit" value="提交" />
<%
end i ......
比较好的学习asp.net的书推荐一下吧,谢谢~~~
書的話等高人推薦, 我認為多上上www.asp.net對你幫助挺大, 那里有很多視頻, 如果是新手的話, 視& ......
ASP.NET 错误 无法识别的标记前缀或设备筛选器“asp”
代码如下:
<%@ Page Language="C#" ContentType="text/xml" AutoEventWireup="true" CodeFile=" ......
在弹出框中点击一个按钮,怎么调转到另一个浏览器,并且在该浏览器打开两个页面
你的意思应该是
response.write("<script>alert('确认'); window.location.href('xxxx.aspx'); </script>"); ......
我的页面里用的AJAX控件 但页面静止一段时间就会出现上面的一个错误是怎么会事呀 怎么解决啊
高手帮帮忙啊
将项目上级目录中的中文名称全部改成英文
楼上说的很清楚了。帮顶一下吧
这个问题不是很常 ......