asp.net实现手机号码归属地查询,代码如下

protected void Button1_Click(object sender, EventArgs e)
{
      if (Regex.IsMatch(TextBox1.Text.Trim(), @"^\d{7,11}$"))
{
      string num = TextBox1.Text.Trim().Substring(0, 7);
      DataRow dr = DAL.oledb.ExecuteDataRow("db.mdb", "select * from list where num = ?", num);
      if (dr != null)
{
     Response.Write(TextBox1.Text.Trim() + "<br />" + dr["city"].ToString() + "<br />" + dr["cardtype"].ToString());
}
}
}

你可能感兴趣的:(asp.net)