不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
乐秀生成工具有时不能成功更新状态Bug
编辑:dnawo 日期:2009-10-21
乐秀生成/状态更新代码如下:
复制内容到剪贴板 程序代码
string[] ids = new string[3];
int num = 60;//图片总数
int count = 0;//选中的图片总数
int currentcount = 0;//当前总数
int rand = (new Random()).Next(1, 60);
//计算选中的图片总数
for (int i = 0; i < num; i++)
if (i % rand == 1)
count++;
//生成
for (int i = 0; i < num; i++)
{
if (i % rand == 1)
{
ids[currentcount % 3] = i + "";
currentcount++;
if (currentcount % 3 == 0 || (currentcount % 3 != 0 && currentcount == count))
{
//生成...
string sql = "Update LX_ResTB SET [Status]=1 Where [Id] in(" + string.Join(",", ids) + ")";
textBox1.Text += sql + "\r\n";
//更新状态...
}
}
}
int num = 60;//图片总数
int count = 0;//选中的图片总数
int currentcount = 0;//当前总数
int rand = (new Random()).Next(1, 60);
//计算选中的图片总数
for (int i = 0; i < num; i++)
if (i % rand == 1)
count++;
//生成
for (int i = 0; i < num; i++)
{
if (i % rand == 1)
{
ids[currentcount % 3] = i + "";
currentcount++;
if (currentcount % 3 == 0 || (currentcount % 3 != 0 && currentcount == count))
{
//生成...
string sql = "Update LX_ResTB SET [Status]=1 Where [Id] in(" + string.Join(",", ids) + ")";
textBox1.Text += sql + "\r\n";
//更新状态...
}
}
}
编辑反馈,有时状态更新不成功!测试后发现:当count的值小于3时,会构造出错误的sql语句(Update LX_ResTB SET [Status]=1 Where [Id] in(1624,1623,)),因而无法成功更新状态。
修改后的代码:
复制内容到剪贴板 程序代码
string[] ids = new string[3] { "0", "0", "0" };
int num = 60;//图片总数
int count = 0;//选中的图片总数
int currentcount = 0;//当前总数
int rand = (new Random()).Next(1, 60);
//计算选中的图片总数
for (int i = 0; i < num; i++)
if (i % rand == 1)
count++;
//生成
for (int i = 0; i < num; i++)
{
if (i % rand == 1)
{
ids[currentcount % 3] = i + "";
currentcount++;
if (currentcount % 3 == 0 || (currentcount % 3 != 0 && currentcount == count))
{
//生成...
string sql = "Update LX_ResTB SET [Status]=1 Where [Id] in(" + string.Join(",", ids) + ")";
textBox1.Text += sql + "\r\n";
//更新状态...
}
}
}
int num = 60;//图片总数
int count = 0;//选中的图片总数
int currentcount = 0;//当前总数
int rand = (new Random()).Next(1, 60);
//计算选中的图片总数
for (int i = 0; i < num; i++)
if (i % rand == 1)
count++;
//生成
for (int i = 0; i < num; i++)
{
if (i % rand == 1)
{
ids[currentcount % 3] = i + "";
currentcount++;
if (currentcount % 3 == 0 || (currentcount % 3 != 0 && currentcount == count))
{
//生成...
string sql = "Update LX_ResTB SET [Status]=1 Where [Id] in(" + string.Join(",", ids) + ")";
textBox1.Text += sql + "\r\n";
//更新状态...
}
}
}
评论: 0 | 引用: 0 | 查看次数: 3345
发表评论
请登录后再发表评论!