当前位置: 代码迷 >> ASP.NET >> ntext类型字段怎么用asp.net(c#)读取和更新
  详细解决方案

ntext类型字段怎么用asp.net(c#)读取和更新

热度:6361   发布时间:2013-02-26 00:00:00.0
ntext类型字段如何用asp.net(c#)读取和更新?
用string   读取能读全吗?读全怎么用?

------解决方案--------------------------------------------------------
可以的 除了查询 其它正常用就行了
------解决方案--------------------------------------------------------
--show

string strQuery= "select ntext from tb where id=1 ";
oText.InnerText=(string)SqlHelper.ExecuteScalar(strConn,CommandType.Text,strQuery);

--update
string strCmd= "update tb set ntext=@content where id=1 ";
int ret=0;
SqlParameter[] param=new SqlParameter[]{
SqlHelper.MakeInParam( "@content ",SqlDbType.NText,0,oText.InnerText)
};
try
{
ret=(int)SqlHelper.ExecuteNonQuery(strConn,CommandType.Text,strCmd,param);
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}

if(ret!=0)
{
ShowText();
}
else
{
Response.Write( "failure! ");
}
------解决方案--------------------------------------------------------
没错。
  相关解决方案