本文整理匯總了C#中WSV.DAL.DataBase.GetDataReader方法的典型用法代碼示例。如果您正苦於以下問題:C# DataBase.GetDataReader方法的具體用法?C# DataBase.GetDataReader怎麽用?C# DataBase.GetDataReader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WSV.DAL.DataBase
的用法示例。
在下文中一共展示了DataBase.GetDataReader方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CheckKey
/// <summary>
/// 檢查主鍵
/// </summary>
/// <param name="Tab">表名</param>
/// <param name="key">要檢查的字段名</param>
/// <param name="value">要檢查的值</param>
/// <param name="Id">Id等於0代表添加操作,否則就是修改操作</param>
public static bool CheckKey(string Tab, string key, string value, long Id)
{
bool Flag = false;
DataBase db = new DataBase();
SqlDataReader dr = null;
try
{
if (Id == 0)
{
db.GetDataReader(out dr, "select * from " + Tab + " where " + key + "='" + value + "'");
if (dr.Read()) { Flag = true; }
}
else
{
db.GetDataReader(out dr, "select * from " + Tab + " where Id<>" + Id + " and " + key + "='" + value + "'");
if (dr.Read()) { Flag = true; }
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
dr.Close();
db.Dispose();
}
return Flag;
}
示例2: BillInfoSql
/// <summary>
/// 查詢出所有的數據
/// </summary>
/// <returns>返回數據源</returns>
public static string BillInfoSql(string Code)
{
string retSql = "";
DataBase db = new DataBase();
DataBaseVisitor visitor = new BillInfoDAL();
SqlDataReader myread;
try
{
db.GetDataReader(visitor, null, out myread, "BillInfoSql");
while(myread.Read())
{
retSql += "," + myread["DBName"].ToString().Trim()+" as " + myread["Name"].ToString().Trim();
}
myread.Close();
retSql= retSql.Substring(1);
retSql = "Select " + retSql + " From V_D_Saver_D Where Code='"+Code.Trim()+"'";
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Dispose();
}
return retSql;
}
示例3: Data_Add
/// <summary>
/// ���������
/// </summary>
/// <param name="s_Pr"></param>
/// <returns></returns>
public static string Data_Add(string s_Pr)
{
string CodeA = "";
DataBase db = new DataBase();
DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
SqlParameter[] prams ={
db.MakeInParam("@Flag", SqlDbType.VarChar,50,s_Pr)
};
SqlDataReader dr = null;
try
{
db.GetDataReader(visitor, prams, out dr, "D_Add");
if (dr.Read())
{
CodeA = dr["Code"].ToString();
}
dr.Close();
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
return CodeA;
}
示例4: MaxID
/// <summary>
/// 最大ID
/// </summary>
/// <param name="Content"></param>
/// <returns></returns>
public static long MaxID()
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new WSV.DAL.MyLog.DL_Run();
long ret_V = 0;
try
{
SqlDataReader dr;
db.GetDataReader(visitor,null,out dr, "MaxID");
if (dr.Read())
{
if(dr[0] !=null)
ret_V = long.Parse(dr[0].ToString());
}
ret_V += 1;
//ds = db.ReturnDataSet(visitor, prams, "Select");
}
catch (Exception ex)
{ return 0; throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
return ret_V;
}
示例5: CheckRolePower
/// <summary>
/// 查詢角色是否擁有某個權限
/// </summary>
/// <param name="RoleCode">角色編號</param>
/// <param name="PowerCode">權限編號</param>
/// <returns></returns>
public static bool CheckRolePower(string RuleName)
{
if (LUser.Id <= 2)
return true;
DataBase db = new DataBase();
DataBaseVisitor visitor = new RoleDAL();
bool Flag = false;
SqlParameter[] prams ={
db.MakeInParam("@RoleCode", SqlDbType.VarChar,50,LUser.Role),
db.MakeInParam("@RuleName", SqlDbType.VarChar,50,RuleName)
};
try
{
SqlDataReader dr;
db.GetDataReader(visitor, prams, out dr, "CheckRolePower");
if (dr.Read())
{
Flag = true;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Dispose();
}
return Flag;
}
示例6: SelectByName
/// <summary>
/// 根據名字查詢編號
/// </summary>
/// <returns></returns>
public static string SelectByName(string Name)
{
string Code = "";
DataBase db = new DataBase();
DataBaseVisitor visitor = new DC_BaseVisitor();
SqlDataReader dr = null;
SqlParameter[] prams ={
db.MakeInParam("@Name", SqlDbType.VarChar,50, Name),
};
try
{
db.GetDataReader(visitor, prams, out dr, "SelectByName");
if (dr.Read())
{
Code = dr["Code"].ToString();
}
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
return Code;
}
示例7: CheckPwd
/// <summary>
/// 檢查用戶密碼
/// </summary>
/// <param name="Item">model</param>
/// <returns></returns>
public static bool CheckPwd(string pass)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new UsersDAL();
bool Flag = false;
SqlParameter[] prams ={
db.MakeInParam("@Uid",SqlDbType.VarChar,50,LUser.Uid),
db.MakeInParam("@Pwd",SqlDbType.VarChar,50,pass)
};
try
{
SqlDataReader dr;
db.GetDataReader(visitor, prams, out dr, "UserLock");
if (dr.Read())
{
Flag = true;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Dispose();
}
return Flag;
}
示例8: AddCurve
public static bool AddCurve(string Code, WSV.Model.Weight.WeightModel value)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new DAL.MyLog.DL_WeightVisitor();
bool retvalue = true;
SqlParameter[] prams ={
db.MakeInParam("@Code",SqlDbType.VarChar,50,Code)
};
SqlDataReader Reader = null;
try
{
db.GetDataReader(visitor, prams, out Reader, "AddCurve");
if (Reader.Read())
{
value.StateFun.Curve = (byte[])Reader["Curve"];
}
else
{
retvalue = false;
}
}
catch (Exception e)
{
db.Dispose();
return false;
}
finally
{
db.Dispose();
}
return retvalue;
}
示例9: DataShowImage
/// <summary>
/// ��ѯëƤͼƬ
/// </summary>
/// <param name="Item"></param>
/// <param name="Code"></param>
public static void DataShowImage(ref Model.Weight.StateModel Item, string Code)
{
SqlDataReader dr = null;
DataBase db = new DataBase();
DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
SqlParameter[] prams ={
db.MakeInParam("@Code",SqlDbType.VarChar,50,Code)
};
try
{
db.GetDataReader(visitor, prams, out dr, "SelectCode");
if (dr.Read())
{
if (dr["G_Image1"] != System.DBNull.Value)
Item.G_Image1 = (byte[])dr["G_Image1"];
if (dr["G_Image2"] != System.DBNull.Value)
Item.G_Image2 = (byte[])dr["G_Image2"];
if (dr["G_Image3"] != System.DBNull.Value)
Item.G_Image3 = (byte[])dr["G_Image3"];
if (dr["G_Image4"] != System.DBNull.Value)
Item.G_Image4 = (byte[])dr["G_Image4"];
if (dr["T_Image1"] != System.DBNull.Value)
Item.T_Image1 = (byte[])dr["T_Image1"];
if (dr["T_Image2"] != System.DBNull.Value)
Item.T_Image2 = (byte[])dr["T_Image2"];
if (dr["T_Image3"] != System.DBNull.Value)
Item.T_Image3 = (byte[])dr["T_Image3"];
if (dr["T_Image4"] != System.DBNull.Value)
Item.T_Image4 = (byte[])dr["T_Image4"];
if (dr["G_Curve"] != System.DBNull.Value)
Item.G_Curve = (byte[])dr["G_Curve"];
if (dr["T_Curve"] != System.DBNull.Value)
Item.T_Curve = (byte[])dr["T_Curve"];
}
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
finally
{
dr.Close();
db.Dispose();
}
}
示例10: DataShow
/// <summary>
/// 查詢
/// </summary>
/// <param name="Item"> model</param>
public static void DataShow(ref Model.Video.D_Video Item)
{
SqlDataReader dr = null;
DataBase db = new DataBase();
DataBaseVisitor visitor = new DAL.Video.VideoVisitor();
SqlParameter[] prams ={
db.MakeInParam("@VIDEO_name", SqlDbType.VarChar, 50, Item.VIDEO_name),
db.MakeInParam("@table", SqlDbType.VarChar, 50, Item.VIDEO_table),
};
try
{
db.GetDataReader(visitor, prams, out dr, "Select_D_Video");
if (dr.Read())
{
Item.VIDEO_Standard = int.Parse(dr["VIDEO_Standard"].ToString());
Item.VIDEO_Brightness = int.Parse(dr["VIDEO_Brightness"].ToString());
Item.VIDEO_Contrast = int.Parse(dr["VIDEO_Contrast"].ToString());
Item.VIDEO_Hue = int.Parse(dr["VIDEO_Hue"].ToString());
Item.VIDEO_Saturation = int.Parse(dr["VIDEO_Saturation"].ToString());
Item.VIDEO_Suality = int.Parse(dr["VIDEO_Suality"].ToString());
}
else
{
Item.VIDEO_Standard = 2;
Item.VIDEO_Brightness = 80;
Item.VIDEO_Contrast = 44;
Item.VIDEO_Hue = 0;
Item.VIDEO_Saturation = 40;
Item.VIDEO_Suality = 0;
}
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
finally
{
dr.Close();
db.Dispose();
}
}
示例11: W_Char
/// <summary>
/// ����SQL�ַ���
/// </summary>
/// <returns></returns>
public static string W_Char()
{
string field = "";
DataBase db = new DataBase();
SqlDataReader oddr = null;
DataBaseVisitor visitor = new WSV.DAL.Weight.WeightDAL();
SqlParameter[] prams ={
db.MakeInParam("@Flag", SqlDbType.VarChar,50," ")
};
db.GetDataReader(visitor, prams, out oddr, "GridViewName");
while (oddr.Read())
{
field += ",[" + oddr["DBName"] + "]";
}
if (!string.IsNullOrEmpty(field)) { field = field.Substring(1); }
return field;
}
示例12: RolePower
/// <summary>
/// 查詢角色擁有的權限
/// </summary>
/// <param name="RoleCode">角色編號</param>
/// <returns></returns>
public static string RolePower(string RoleCode)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new RoleDAL();
string Nid = "";
SqlParameter[] prams ={
db.MakeInParam("@RoleCode", SqlDbType.VarChar,50,RoleCode)
};
try
{
SqlDataReader dr;
db.GetDataReader(visitor, prams, out dr, "RolePower");
while (dr.Read())
{
Nid += "," + dr["PowerCode"];
}
if (!string.IsNullOrEmpty(Nid)) { Nid = Nid.Substring(1); }
}
catch (Exception ex)
{
throw ex;
}
finally
{
db.Dispose();
}
return Nid;
}
示例13: SelectName
/// <summary>
/// ���ؽ����ѯ
/// </summary>
/// <param name="s_Pr"></param>
/// <param name="s_pr1"></param>
/// <returns></returns>
public static bool SelectName(string flag, WeightModel Item)
{
bool retvalue = true;
if (flag == "")
{
return false;
}
DataBase db = new DataBase();
DataBaseVisitor visitor = new DAL.Weight.PlanDAL();
SqlParameter[] prams ={
db.MakeInParam ("@flag",SqlDbType.VarChar ,50,flag ),
};
SqlDataReader getReader = null;
try
{
db.GetDataReader(visitor, prams, out getReader, "selectCode");
if (getReader.Read())
{
Item.Txt.Plan_Code=getReader["Plan_Code"].ToString();
}
else
{
retvalue = false;
}
getReader.Close();
}
catch (Exception err)
{
db.Dispose();
return false;
}
finally
{
db.Dispose();
}
return retvalue;
}
示例14: ValiDateCode
/// <summary>
/// 驗證編號是否存在
/// </summary>
/// <param name="CodeID">D_Base編號</param>
/// <param name="ParentCode">父類編號-DC_Base表編號</param>
/// <returns></returns>
public static bool ValiDateCode(string CodeID, string ParentCode)
{
bool Flag = false;
DataBase db = new DataBase();
DataBaseVisitor visitor = new D_BaseVisitor();
SqlDataReader dr = null;
SqlParameter[] prams ={
db.MakeInParam("@CodeID", SqlDbType.VarChar,50, CodeID),
db.MakeInParam("@ParentCode", SqlDbType.VarChar,50, ParentCode),
};
try
{
db.GetDataReader(visitor, prams, out dr, "SelectByCode");
if (dr.Read())
{
Flag = true;
}
dr.Close();
}
catch (Exception ex)
{ throw new Exception(ex.Message); }
finally
{
db.Dispose();
}
return Flag;
}
示例15: GetPlan
/// <summary>
/// 根據編號查詢表內容
/// </summary>
/// <param name="Item">D_Plan表model</param>
public static void GetPlan(ref Model.Plan.D_Plan Item)
{
DataBase db = new DataBase();
DataBaseVisitor visitor = new DAL.Plan.PlanVisitor();
SqlDataReader dr = null;
SqlParameter[] prams ={
db.MakeInParam("@Plan_Code", SqlDbType.VarChar,50, Item.Plan_Code),
};
try
{
db.GetDataReader(visitor, prams, out dr, "Select_D_PlanByCode");
if (dr.Read())
{
Item.Plan_Item = dr["Plan_Item"].ToString();
Item.Plan_Send = dr["Plan_Send"].ToString();
Item.Plan_Specs = dr["Plan_Specs"].ToString();
Item.Plan_Accept = dr["Plan_Accept"].ToString();
Item.Plan_CountWay = dr["Plan_CountWay"].ToString();
Item.Plan_Type = dr["Plan_Type"].ToString();
Item.Plan_Num = Convert.ToDecimal(dr["Plan_Num"]);
Item.Plan_SpareNum = Convert.ToDecimal(dr["Plan_SpareNum"]);
Item.Plan_Money = Convert.ToDecimal(dr["Plan_Money"]);
Item.Plan_SpareMoney = Convert.ToDecimal(dr["Plan_SpareMoney"]);
Item.Remark = dr["Remark"].ToString();
}
}
catch (Exception ex) { throw new Exception(ex.Message); }
finally
{
dr.Close();
db.Dispose();
}
}