zoukankan      html  css  js  c++  java
  • 判断DataReader是不是为空!

    代码
    string connString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=";
                connString 
    += Server.MapPath("~/jinhai.mdb");
                OleDbConnection conn 
    = new OleDbConnection(connString);
                
    string seStr = "select * from kehu where user_name like @user_name";
                OleDbCommand comm 
    = new OleDbCommand(seStr, conn);
                
    string name = "%" + txtName1.Text.ToString().Trim() + "%";
                comm.Parameters.AddWithValue(
    "@user_name", name);
                conn.Open();
                OleDbDataReader dr 
    = comm.ExecuteReader();
                
    if (dr.HasRows)
                {
                    myReapeter.DataSource 
    = dr;
                    myReapeter.DataBind();
                }
                
    else
                {
                    
    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "afsdgfdh""alert('没有此客户的任何记录!');"true);
                }
                dr.Close();
                conn.Close(); 
  • 相关阅读:
    How To Install MySQL on Ubuntu 16.04
    Rabbitmq vs. kafka
    Expanded encryption and decryption signature algorithm SM2 & SM3
    Open Source CRM
    在WIN10打造成能运行Oracle的JDK的Linux
    Spring Cloud Zipkin
    Debian中APT的前世今生
    nginx for Windows Known issues:path
    Ajax cross domain
    JQuery Cross Domain Ajax(jsonp)
  • 原文地址:https://www.cnblogs.com/hantianwei/p/1696684.html
Copyright © 2011-2022 走看看