public static string login(Manager mag)//判断经理用户名密码是否一致 { string str = ""; SqlDataReader sqlrd; DataBase db = new DataBase(); string sql = "select tKey from tb_Manager where Name='" + mag.Name + "'"; sqlrd = db.GetDataReader(sql); while (sqlrd.Read()) { str = (string)(sqlrd["tKey"]); } return str; }
public static string login(Stuff stf)//判断员工用户名密码是否一致 { string str=""; SqlDataReader sqlrd; DataBase db = new DataBase(); string sql = "select tKey from tb_Stuff where Name='" + stf.Name + "'"; sqlrd=db.GetDataReader(sql); while(sqlrd.Read ()) { str = (string)(sqlrd["tKey"]); } return str; }
public static DataTable GetData(DataBase dataBaseType, CommandType commandType, string query, SqlParameter[] parameters = null) { SqlConnection conn = new SqlConnection(GetConnectionStaring(dataBaseType)); SqlCommand cmd = conn.CreateCommand(); SqlDataReader reader = null; try { cmd.CommandType = commandType; cmd.CommandText = query; if (parameters != null) parameters.ToList().ForEach(s => { cmd.Parameters.Add(s); }); DataTable dt = new DataTable(); conn.Open(); reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); dt.Load(reader); return dt; } catch (Exception ex) { throw; } finally { if (reader != null && !reader.IsClosed) { reader.Close(); } if (cmd != null) { if (cmd.Parameters != null) { cmd.Parameters.Clear(); } cmd.Dispose(); } if (conn != null && conn.State == ConnectionState.Open) { conn.Close(); conn.Dispose(); } } }
public static int StoreData_ExecuteNonQuery(DataBase dataBaseType, CommandType commandType, string query, SqlParameter[] parameters = null) { return(StoreData_ExecuteNonQuery(dataBaseType, commandType, query, parameters, null)); }
public static void Save() { DataBase db = new DataBase(); string sql = "insert "; }
public static DataTable GetAllUser() { DataBase db = new DataBase(); return db.GetDataTable("Select * from Customer"); }
public DataTable getRegion(String strWhere) { String sql = "select * from DictRegion where 1=1 " + strWhere; return(DataBase.Base_dt(sql)); }
public static int StoreData_ExecuteNonQuery(DataBase dataBaseType, CommandType commandType, string query, SqlParameter[] parameters = null, List<TVParameter> TVParameters = null) { SqlConnection conn = new SqlConnection(GetConnectionStaring(dataBaseType)); SqlCommand cmd = conn.CreateCommand(); try { cmd.CommandType = commandType; cmd.CommandText = query; if (parameters != null) parameters.ToList().ForEach(s => { cmd.Parameters.Add(s); }); if (TVParameters != null) TVParameters.ToList().ForEach(s => { SqlParameter tvpParam = cmd.Parameters.AddWithValue(s.ParameterName, s.ParameterValue); tvpParam.SqlDbType = s.SqlDbType; tvpParam.TypeName = s.ParameterTypeName; }); conn.Open(); return cmd.ExecuteNonQuery(); } catch (Exception ex) { throw; } finally { if (cmd != null) { if (cmd.Parameters != null) { cmd.Parameters.Clear(); } cmd.Dispose(); } if (conn != null && conn.State == ConnectionState.Open) { conn.Close(); conn.Dispose(); } } }
public static int StoreData_ExecuteNonQuery(DataBase dataBaseType, CommandType commandType, string query, SqlParameter[] parameters = null) { return StoreData_ExecuteNonQuery(dataBaseType, commandType, query, parameters, null); }
private static string GetConnectionStaring(DataBase dataBaseType) { if (_con == null) { _con = ConfigurationManager.ConnectionStrings[dataBaseType.ToString()].ConnectionString; } return _con; }
public static void StoreData_ExecuteNonQuery_ParamList(DataBase dataBaseType, CommandType commandType, string query, List<SqlParameter[]> parametersList = null) { if (parametersList == null || parametersList.Count == 0) { StoreData_ExecuteNonQuery(dataBaseType, commandType, query, null); return; } else { parametersList.ForEach(pL => { StoreData_ExecuteNonQuery(dataBaseType, commandType, query, pL); }); } }
public DataTable getProductsById(String id) { String sql = "select * from Products where Id='" + id + "'"; return(DataBase.Base_dt(sql)); }
public DataTable getProducts() { String sql = "select * from Products where state=1"; return(DataBase.Base_dt(sql)); }
public bool Delete(String id) { String sql = "delete [dbo].[OrdersDetail] where Id='" + id + "'"; return(DataBase.Base_cmd(sql)); }