----------------------客户端调用Webservice里面的方法------------------------------
if (ser.IsMake(txtDistinction.Text.Trim(), lblType.Text.Trim(), 2))
{
MessageBox.Show("该飞达已经校正!");
txtDistinction.Text = "";
txtDistinction.Focus();
return;
}-----------------------Webservice里面的方法--------------------------------------------------
public bool IsMake(string dis, string type, int oid)
{
bool flag = false;
string sql = "select Top(1) * from Logbook where Distinction='{0}' and OperateID={1} order by DateTime desc";
sql = string.Format(sql, dis, oid);
DataTable dst = ExecuteQuery(sql); string sqlType = "select * from Type where TypeName='{0}' and Operate={1}";
sqlType = string.Format(sqlType, type, oid);
DataTable dstType = ExecuteQuery(sqlType);
if (dst != null && dstType != null && dst.Rows.Count > 0 && dstType.Rows.Count > 0)
{
DateTime tim = Convert.ToDateTime(dst.Rows[0]["DateTime"].ToString());
tim.AddMonths(Convert.ToInt32(dstType.Rows[0]["Cycle"].ToString()));
string sqlReturn = "select * from Logbook where Distinction='{0}' and DateTime>='{1}' and DateTime<='{2}' and OperateID={3}";
sqlReturn = string.Format(sqlReturn, dis, dst.Rows[0]["DateTime"].ToString(), tim.ToString(), oid);
DataTable dstRe = ExecuteQuery(sqlReturn);
if (dstRe != null && dstRe.Rows.Count > 0)
{
flag = true;
}
}
return flag;
}
-----------------------用三个SQL语句都有的数据去测试HTTP里面的Webservice返回的是true 但客户端调用那返回的确是false 传入的参数都是一样的 返回结果却不同我晕死了 求大神帮忙啊!
if (ser.IsMake(txtDistinction.Text.Trim(), lblType.Text.Trim(), 2))
{
MessageBox.Show("该飞达已经校正!");
txtDistinction.Text = "";
txtDistinction.Focus();
return;
}-----------------------Webservice里面的方法--------------------------------------------------
public bool IsMake(string dis, string type, int oid)
{
bool flag = false;
string sql = "select Top(1) * from Logbook where Distinction='{0}' and OperateID={1} order by DateTime desc";
sql = string.Format(sql, dis, oid);
DataTable dst = ExecuteQuery(sql); string sqlType = "select * from Type where TypeName='{0}' and Operate={1}";
sqlType = string.Format(sqlType, type, oid);
DataTable dstType = ExecuteQuery(sqlType);
if (dst != null && dstType != null && dst.Rows.Count > 0 && dstType.Rows.Count > 0)
{
DateTime tim = Convert.ToDateTime(dst.Rows[0]["DateTime"].ToString());
tim.AddMonths(Convert.ToInt32(dstType.Rows[0]["Cycle"].ToString()));
string sqlReturn = "select * from Logbook where Distinction='{0}' and DateTime>='{1}' and DateTime<='{2}' and OperateID={3}";
sqlReturn = string.Format(sqlReturn, dis, dst.Rows[0]["DateTime"].ToString(), tim.ToString(), oid);
DataTable dstRe = ExecuteQuery(sqlReturn);
if (dstRe != null && dstRe.Rows.Count > 0)
{
flag = true;
}
}
return flag;
}
-----------------------用三个SQL语句都有的数据去测试HTTP里面的Webservice返回的是true 但客户端调用那返回的确是false 传入的参数都是一样的 返回结果却不同我晕死了 求大神帮忙啊!
如果为true,就还是你sql中返回的问题
你在客户端把那3个参数直接用字符串传,用和你做WebService测试时一样的数据看一下,是不是返回值还有不同?