private string MonthToString(int month)
{
if (month >= 1 && month <= 9)
return "0" + month.ToString();
else
return month.ToString();
}
}
}
DBHelp类源码:
复制代码 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace GridViewSortTest
{
public class DBHelp
{
//连接字符串
static string strConn =@"Server=.SQLEXPRESS; Database= SysBusiness; User Id=sa; Password=123456;Trusted_Connection = False ";
#region 执行查询,返回DataTable对象-----------------------
public static DataTable GetTable(string strSQL)
{
return GetTable(strSQL, null);
}
public static DataTable GetTable(string strSQL, SqlParameter[] pas)
{
return GetTable(strSQL, pas, CommandType.Text);
}
/// <summary>
/// 执行查询,返回DataTable对象
/// </summary>
/// <param name="strSQL">sql语句</param>
/// <param name="pas">参数数组</param>
/// <param name="cmdtype">Command类型</param>
/// <returns>DataTable对象</returns>
public static DataTable GetTable(string strSQL, SqlParameter[] pas, CommandType cmdtype)
{










