网页在本地服务器上运行没问题,但一放在虚拟主机上就出错?
用c#做的网页在我的机子上运行一点问题都没有,但是一放在虚拟主机上就出问题:
我机子上的asp.net的版本号和虚拟主机上的一样。
1.验证控件没起作用,不管怎样网页都提交。
2.用SqlDataAdapter刷新数据库出错。出错内容如下:
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
我的代码如下:txtNum位textBox控件 dsStaferInfo为已初始化的DataSet。
private void btnReWrite_Click(object sender, System.EventArgs e)
{
string strSql="select * from 表905_职员基本信息表";
SqlDataAdapter adapter=new SqlDataAdapter (strSql,cnnString);
SqlCommandBuilder builder=new SqlCommandBuilder (adapter);
adapter.Fill (dsStaferInfo);
DataTable dtTable=dsStaferInfo.Tables[0];
strSql="职员编号='" + txtNum.Text.Trim()+"'";
DataRow[] rows=dtTable.Select(strSql);
foreach (DataRow row in rows)
{
drRow["职员编号"]=txtNum.Text.Trim ();
adapter.Update (dtTable);
Application.Remove("DataSet");
Application.Add ("DataSet",dsStaferInfo );
}
}