作为查询条件的一个接受值的textbox只要输入的能查询出数据的 则“有效”一旦输入的查询不出数据的 则报错“输入字符串格式不正确 ”
为什么 ps:csdn 经常我都登陆了 ,一发帖子说我为登陆把我所有写的帖子内容都给作废了 晕死
让我重复劳动 大家可有发现此类情况的
为什么 ps:csdn 经常我都登陆了 ,一发帖子说我为登陆把我所有写的帖子内容都给作废了 晕死
让我重复劳动 大家可有发现此类情况的
显示数据的控件如:gridview 的数据源 List 不能等于null
为空是报错
<tr>
<td>投诉流水号</td>
<td><asp:TextBox ID="tb_cmsm_no" runat="server"></asp:TextBox></td>
<td>负责人</td>
<td><asp:TextBox ID="tb_fzr_id" runat="server"></asp:TextBox><input id="Button2" style="width: 23px" type="button" onclick="funct2('tb_fzr_id');" /></td>
<td >所在部门</td>
<td>
<asp:TextBox ID="tb_szbm" runat="server"></asp:TextBox> <input id="Button1" style="width: 23px" type="button" onclick="funct1('tb_szbm');" /></td>
<td><asp:Button ID="bt_query" runat="server" Text="查询" OnClick="bt_query_Click" /></td>
</tr>接受数据的都是这些TextBox 数据库的字段都是varchar形式的 砸的就不对呢
this.txt_Id.Attributes.Add("onblur", "checkthis.value)");
function check(id) {
if (id == "")
return;
document.getElementById("id_msg").innerHTML = "检查中,请稍候……";
var url = "../RegistValidate.ashx?name=" + escape(id);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = ShowResult;
xmlHttp.send(null);
}
function ShowResult() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var s;
s = xmlHttp.responseText;
if (s== "OK")
document.getElementById("id_msg").innerHTML = "";
else
document.getElementById("id_msg").innerHTML = "";
}
else {
document.getElementById("id_msg").innerHTML =xmlHttp.status;
}
}
}
<asp:textbox id="txt_Id" runat="server" Width="70%" MaxLength="20"></asp:textbox><span id="id_msg"></span>
SqlParameter[] parm = new SqlParameter[] {
SqlHelper.GetParameter("@col2", SqlDbType.VarChar, 30, "col2", col12.Text.Trim()+"%"),
SqlHelper.GetParameter("@col1", SqlDbType.VarChar, 20, "col1", col1.Text.Trim()+"%")
};
ls_sql = "xxxxxxxxxx";
try
{
DataTable dt = SqlHelper.ExecuteNonDT(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, ls_sql, null, parm);
if (dt.Rows.Count <= 0)
{
dt.Rows.Add();
} Gv.DataSource = dt.DefaultView;
Gv.DataBind();//如果查询不出结果的话,试调的时候 catch错误从这里开始报的,
//如果能查询出来数据的话 是不报错的
}
catch (Exception ee)
{
Public_Fun.MessageBox(ee.Message, this);
}
查询出来数据不报错,说明后台没有问题只有查不出的时候才报错的
DataTable dt = SqlHelper.ExecuteNonDT(SqlHelper.ConnectionStringLocalTransaction, ....
Gv.DataSource = dt;
Gv.DataBind();
跟踪了好多次了,就是有数据出来正确,无报错
而且是在 databind 时候弹出catch 的错误 晕啊
这个是我试 了一下 还是老问题【有数据出现对,无数据出现报错】具体什么情况,查询的列里是有null值的 但是不是要查询的列,是其它列也有影响吗