![](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
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();
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();