第七篇
1 检查SQL的纪录是不是存在
2 时间比较前后
3 判断字符是否在字符数组当中
4 SQL语句中的2个参数帮助方法 【在参数中判断来判断去的蛋疼】
Object SqlParaHelperDev(Object AObject)
{
if (AObject == null || AObject.ToString() == "")
return DBNull.Value;
return (Object)AObject;
}
string SqlParaHelper(string AObject)
{
return AObject.Trim();
}
private bool TreeColumnHelper(string p, string[] stirngs)
{
foreach (string tempString in stirngs)
{
if (p.Equals(tempString))
return true;
}
return false;
}
public int DateTimeCompareTo(Object a, Object b)
{
if (a == null || b == null || b.ToString() == "" || a.ToString() == "")
return 100;
else
return Convert.ToDateTime(a).Date.CompareTo(Convert.ToDateTime(b).Date);
}
private bool CheckSql(String checkSql, SqlParameter[] para)
{
Object obj = SqlHelper.ExecuteScalar(connString, CommandType.Text, checkSql, para);
if (obj != null && (int)obj == 1)
return true;
return false;
}
private bool CheckSql(String checkSql)
{
Object obj = SqlHelper.ExecuteScalar(connString, CommandType.Text, checkSql);
if (obj != null && (int)obj == 1)
return true;
return false;
}
{
if (a == null || b == null || b.ToString() == "" || a.ToString() == "")
return 100;
else
return Convert.ToDateTime(a).Date.CompareTo(Convert.ToDateTime(b).Date);
}
private bool CheckSql(String checkSql, SqlParameter[] para)
{
Object obj = SqlHelper.ExecuteScalar(connString, CommandType.Text, checkSql, para);
if (obj != null && (int)obj == 1)
return true;
return false;
}
private bool CheckSql(String checkSql)
{
Object obj = SqlHelper.ExecuteScalar(connString, CommandType.Text, checkSql);
if (obj != null && (int)obj == 1)
return true;
return false;
}