本文整理汇总了C#中System.Data.OleDb.OleDbDataReader.GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbDataReader.GetFloat方法的具体用法?C# OleDbDataReader.GetFloat怎么用?C# OleDbDataReader.GetFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.OleDb.OleDbDataReader
的用法示例。
在下文中一共展示了OleDbDataReader.GetFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e) {
paramSexo = "";
paramNome = "";
try {
paramSexo = Request["RadioButtonList1"];
paramNome = Request["TextBox1"];
if (paramSexo == null) paramSexo = "";
if (paramNome == null) paramNome = "";
}
catch(Exception){};
Label1.Text = "Registros encontrados:";
String filtro1 = "", filtro2 = "";
if (paramSexo.Equals("Todos")) {
filtro1 = " TRUE ";
}
else if (paramSexo.Equals("Masculino")) {
filtro1 = " (sexo='M') ";
}
else if (paramSexo.Equals("Feminino"))
{
filtro1 = " (sexo='F') ";
}
else
{
filtro1 = " FALSE ";
Label1.Text = "";
}
filtro2 = " (nomeprof LIKE '%" + paramNome + "%') ";
try {
conexao = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/temp/Escola.mdb");
conexao.Open();
string sql = "select * from professores WHERE "
+ filtro1 + " AND " + filtro2 + " ORDER BY nomeprof";
stm = new OleDbCommand(sql, conexao);
dr = stm.ExecuteReader();
String strHTML = "";
if (dr.HasRows) { //mostramos o cabeçalho da <table> somente se temos registros
strHTML = "<TABLE name=profs border=1 width='65%'> <TR style='font-size: 14px; font-family: verdana; text-align: center; font-weight: 900; color: #009;'>"
+ "<TD> Código </TD><TD> Nome </TD>"
+ "<TD> Sexo </TD><TD> Salário </TD></TR>";
}
while (dr.Read()) {
int codigo = dr.GetInt16(0); //codprof
String nome = dr.GetString(1); //nome
String sexo = dr.GetString(2); //sexo
float salario = dr.GetFloat(3); //salário
strHTML += "<TR><TD style='font-size: 12px; font-family: verdana; text-align: center;'>" + codigo
+ "</TD><TD style='font-size: 12px; font-family: verdana; text-align: left;'> "
+ nome + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: center;'>"
+ sexo + "</TD><TD style='font-size: 12px; font-family: verdana; text-align: center;'>"
+ salario + "</TD></TR>";
}
strHTML += "</TABLE> <br/><br/><br/>";
LiteralControl lc = new LiteralControl(strHTML);
Panel2.Controls.Add(lc);
stm.Dispose();
dr.Close();
conexao.Close();
} catch (Exception exc) {
Label1.Text = "Erro no processamento do BD - " + exc.Message;
}
}