本文整理汇总了C#中DbHelper.CloseDbConnection方法的典型用法代码示例。如果您正苦于以下问题:C# DbHelper.CloseDbConnection方法的具体用法?C# DbHelper.CloseDbConnection怎么用?C# DbHelper.CloseDbConnection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbHelper
的用法示例。
在下文中一共展示了DbHelper.CloseDbConnection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObterItemAESPorNumeroAES
public List<DadosAES> ObterItemAESPorNumeroAES(string numeroAES)
{
List<DadosAES> listaAES = new List<DadosAES>();
DbHelper db = new DbHelper();
string cmdText = @"select b.Numero_AES, b.Item_AES
from Frequencia4Edicao a, [dbo].[vw_mantida_curso_turma] b
where 1=1
and a.idCursoTurnoTurma = b.idCursoTurnoTurma
and b.Numero_AES = @Numero_AES
group by b.Numero_AES, b.Item_AES
order by 2";
db.AddParameter(new System.Data.SqlClient.SqlParameter("@Numero_AES", numeroAES));
SqlDataReader dr = db.GetDataReader(cmdText);
if (dr.HasRows)
{
while (dr.Read())
{
listaAES.Add(new DadosAES
{
NumeroAES = dr["Numero_AES"].ToString(),
ItemAES = Convert.ToInt32(dr["Item_AES"])
});
}
}
db.CloseDbConnection();
return listaAES;
}
示例2: ObterAES
private List<DadosAES> ObterAES(int codDe, bool somentePlanoContigencia)
{
var lista = new List<DadosAES>();
DbHelper db = new DbHelper();
db.AddParameter(new System.Data.SqlClient.SqlParameter("@codDe", codDe));
string cmdText = string.Format(@"SELECT wmc.Cod_DE,
mant.edicao,
mant.NM_Credenciamento,
mant.Numero_AES,
mant.Mantida,
dt.Diretoria,
mant.Item_AES,
mant.Cod_Mantida,
format(parc.mesInicial,'MM/yyyy') as mes_ref,
parc.tipoparcela,
CASE parc.tipoparcela
WHEN 'F' THEN 'SIM' ELSE 'NÃO'
END AS PARCELA_FINAL,
parc.staPLCV
from [dbo].vw_mantida mant,
[VENCE].[dbo].[MtdParcela] parc,
[dbo].[vw_mantida_curso] wmc,
DiretoriaTokenContigencia dt
where {0}
and wmc.cod_de = @codDe
and wmc.Cod_DE = dt.CD_DE
and wmc.Cod_Mantida = mant.Cod_Mantida
and mant.idContratoMtd = PARC.idContratoMtd
group by wmc.Cod_DE,
mant.edicao,
mant.NM_Credenciamento,
mant.Numero_AES,
mant.Mantida,
dt.Diretoria,
mant.Item_AES,
mant.Cod_Mantida,
parc.staPLCV,
parc.mesInicial,
parc.tipoparcela
order by mant.Cod_Mantida,
mant.Item_AES,
parc.mesInicial", (somentePlanoContigencia == true ? "parc.staPLCV is not null" : "1=1"));
SqlDataReader dr = db.GetDataReader(cmdText);
if (dr.HasRows)
{
while (dr.Read())
{
lista.Add(new DadosAES
{
CodMantida = Convert.ToInt32(dr["Cod_Mantida"]),
Mantida = dr["Mantida"].ToString(),
CodDE = dr["Cod_DE"] != DBNull.Value ? Convert.ToInt32(dr["Cod_DE"]) : 0,
NumeroAES = dr["Numero_AES"].ToString(),
Diretoria = dr["Diretoria"].ToString(),
ItemAES = Convert.ToInt32(dr["Item_AES"]),
MesReferencia = dr["mes_ref"].ToString(),
TipoParcela = dr["tipoparcela"].ToString(),
EhParcelaFinal = dr["PARCELA_FINAL"].ToString(),
staPLCV = dr["Cod_DE"] != DBNull.Value ? dr["staPLCV"].ToString() : ""
});
}
}
db.CloseDbConnection();
return lista;
}
示例3: ObterDeApartirDoToken
private int ObterDeApartirDoToken(string chave)
{
DbHelper db = new DbHelper();
db.AddParameter(new System.Data.SqlClient.SqlParameter("@chave", chave));
string cmdText = "select cd_de from [dbo].[DiretoriaTokenContigencia] where token = @chave";
int codDe = db.GetExecuteScalar<int>(cmdText);
db.CloseDbConnection();
return codDe;
}
示例4: ObterListagemObjetos
public List<VwAcompMensal> ObterListagemObjetos(string numeroAES, int itemAES)
{
var acompList = new List<VwAcompMensal>();
DbHelper db = new DbHelper();
db.AddParameter(new System.Data.SqlClient.SqlParameter("@numeroAES", numeroAES));
db.AddParameter(new System.Data.SqlClient.SqlParameter("@itemAES", itemAES));
string cmdText = @"select b.Numero_AES, b.Item_AES, count(distinct idMatricula) qtdAlunos, a.MesReferencia
from Frequencia4Edicao a, [dbo].[vw_mantida_curso_turma] b
where 1=1
and a.idCursoTurnoTurma = b.idCursoTurnoTurma
and b.Numero_AES = @numeroAES
and b.Item_AES = @itemAES
--and staPLCV = 'P'
group by b.Numero_AES, b.Item_AES, a.MesReferencia
order by 1,2";
SqlDataReader dr = db.GetDataReader(cmdText);
if (dr.HasRows)
{
while (dr.Read())
{
acompList.Add(new VwAcompMensal
{
NumeroAES = dr["Numero_AES"].ToString(),
ItemAES = Convert.ToInt32(dr["Item_AES"]),
QtdAlunos = Convert.ToInt32(dr["qtdAlunos"]),
MesReferencia = dr["MesReferencia"].ToString()
});
}
}
db.CloseDbConnection();
return acompList;
}