我代码是这么写的 string b = html.GetHTML("http://ent.qq.com" + href[count].Groups[0].Value, "gb2312"); System.Text.RegularExpressions.MatchCollection aa = quanwen.Matches(b); foreach (Match k in aa) { if (k.ToString() != ""&&k.ToString().Length>150) { n.ContentText1 = (k.ToString()); } else { break; } } 如果 if (k.ToString() != ""&&k.ToString().Length>150)就插入数据,否则就是为空了,但是为空了怎么样才能跳出不插入呢我写了break也不行
这跟存储过程没什么关系吧 就是一个判断if(isemptyornull(xxx)) { insert into ... }
你的后面应该还有代码吧 你写的break是跳出循环 后面的代码一样执行
if(isemptyornull(xxx)) { insert into ... }这个是什么意思呢?可以吗
if ( @ContentText is not null) AND (@ContentText <> '') insert .....
create procedure p_microblogging .......... @ContentText text ........... asif ( @ContentText is not null) AND (@ContentText <> '') insert into microblogging(.....,ContentText) values(....,@ContentText)
我按照你的这样写了[url=http://]可是一执行就报错了
if(@ContentText is not null AND @ContentText <> '') begin insert into microblogging...... end
do nothing
else
insert。
这里有空值,我想做到在插入的时候,如果插入ContentText这条字段的值为空的,就直接把这一条所有的数据都给舍弃了不插入,否则的就插入,求存储过程呀
System.Text.RegularExpressions.MatchCollection aa = quanwen.Matches(b);
foreach (Match k in aa)
{
if (k.ToString() != ""&&k.ToString().Length>150)
{
n.ContentText1 = (k.ToString());
}
else
{
break;
}
}
如果 if (k.ToString() != ""&&k.ToString().Length>150)就插入数据,否则就是为空了,但是为空了怎么样才能跳出不插入呢我写了break也不行
{
insert into ...
}
{
insert into ...
}这个是什么意思呢?可以吗
if ( @ContentText is not null) AND (@ContentText <> '')
insert .....
..........
@ContentText text
...........
asif ( @ContentText is not null) AND (@ContentText <> '')
insert into microblogging(.....,ContentText) values(....,@ContentText)
begin
insert into microblogging......
end