本文整理汇总了C#中DataAccessLayer.GetDataReader方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccessLayer.GetDataReader方法的具体用法?C# DataAccessLayer.GetDataReader怎么用?C# DataAccessLayer.GetDataReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccessLayer
的用法示例。
在下文中一共展示了DataAccessLayer.GetDataReader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayRecord
public ClientMasterInfo DisplayRecord(IModelObject KeyObject)
{
string sqlString = string.Empty;
sqlString = "SELECT clm_iRecID," + Environment.NewLine;
sqlString += "clm_cClientNum," + Environment.NewLine;
sqlString += "clm_cEnglishName," + Environment.NewLine;
sqlString += "clm_cChinaName," + Environment.NewLine;
sqlString += "clm_cTaxNumber," + Environment.NewLine;
sqlString += "clm_cLinkman," + Environment.NewLine;
sqlString += "clm_cAddress," + Environment.NewLine;
sqlString += "clm_cPhone," + Environment.NewLine;
sqlString += "clm_cFax," + Environment.NewLine;
sqlString += "clm_cWebSite," + Environment.NewLine;
sqlString += "clm_cRemark," + Environment.NewLine;
sqlString += "clm_cAdd," + Environment.NewLine;
sqlString += "clm_dAddDate," + Environment.NewLine;
sqlString += "clm_cLast," + Environment.NewLine;
sqlString += "clm_dLastDate " + Environment.NewLine;
sqlString += " FROM ClientMaster_clm " + Environment.NewLine;
sqlString += " WHERE clm_iRecID=" + KeyObject.RecordID.ToString();
DataAccessLayer dal = new DataAccessLayer();
ClientMasterInfo clientMaster = null;
SqlDataReader dr = null;
try
{
dr = dal.GetDataReader(sqlString);
if (dr != null)
{
if (dr.Read())
{
clientMaster = GetRecord(dr);
}
}
}
catch (Exception Ex)
{
throw Ex;
}
finally
{
if (dr != null)
{
dr.Close();
}
}
return clientMaster;
}
示例2: GetRecordForSql
private ClientMasterInfo GetRecordForSql(string sql)
{
LocalLayer.LocalDefine localDefine = new DAL.SqlDAL.LocalLayer.LocalDefine();
string sqlString = string.Empty;
DataAccessLayer dal = new DataAccessLayer();
ClientMasterInfo clientMaster = null;
SqlDataReader dr = null;
try
{
dr = dal.GetDataReader(sql);
if (dr != null)
{
if (dr.Read())
{
clientMaster = GetRecord(dr);
}
}
}
catch (Exception Ex)
{
throw Ex;
}
finally
{
if (dr != null)
{
dr.Close();
}
}
return clientMaster;
}
示例3: SearchRecords
public List<ClientMasterInfo> SearchRecords(ClientMasterInfo clientMasterInfo)
{
string sqlString = string.Empty;
string whereString = string.Empty;
sqlString = "SELECT TOP 100 clm_iRecID,"+Environment.NewLine;
sqlString+="clm_cClientNum,"+Environment.NewLine;
sqlString+="clm_cEnglishName,"+Environment.NewLine;
sqlString+="clm_cChinaName,"+Environment.NewLine;
sqlString += "clm_cTaxNumber," + Environment.NewLine;
sqlString+="clm_cLinkman,"+Environment.NewLine;
sqlString+="clm_cAddress,"+Environment.NewLine;
sqlString+="clm_cPhone,"+Environment.NewLine;
sqlString+="clm_cFax,"+Environment.NewLine;
sqlString+="clm_cWebSite,"+Environment.NewLine;
sqlString+="clm_cRemark,"+Environment.NewLine;
sqlString+="clm_cAdd,"+Environment.NewLine;
sqlString+="clm_dAddDate,"+Environment.NewLine;
sqlString+="clm_cLast,"+Environment.NewLine;
sqlString+="clm_dLastDate "+Environment.NewLine;
sqlString+=" FROM ClientMaster_clm ";
if (clientMasterInfo != null)
{
whereString = " WHERE 1=1 ";
if (clientMasterInfo.ClmCClientNum.Trim().Length > 0)
{
whereString += " AND clm_cClientNum='" + clientMasterInfo.ClmCClientNum.Trim().Replace("'","''")+"'";
}
if (clientMasterInfo.ClmCChinaName.Trim().Length > 0)
{
//whereString += " AND clm_cChinaName LIKE N'" + General.ReplaceSQLLikeCondition(clientMasterInfo.ClmCChinaName.Trim().Replace("'", "''")) + "'";
}
}
sqlString += whereString;
DataAccessLayer dal = new DataAccessLayer();
List<ClientMasterInfo> clientMasterInfoList=null;
SqlDataReader dr = null;
try
{
dr = dal.GetDataReader(sqlString);
if (dr != null)
{
clientMasterInfoList = new List<ClientMasterInfo>();
ClientMasterInfo cmInfo = null;
while (dr.Read())
{
cmInfo = GetRecord(dr);
clientMasterInfoList.Add(cmInfo);
}
}
}
catch (Exception Ex)
{
throw Ex;
}
finally
{
if (dr != null)
{
dr.Close();
}
}
return clientMasterInfoList;
}