查询系统源代码(包括区号、邮编、手机查询程序)
Type:完整代码 Category:)TZ$O%^|Q4L+hDfa
其它
License:*l Ax Q |F:dg
GNU General Public License Language:
C#
/Bjo:s5A RG
Description:5KR]#wlJg3P-e
程序要求:
1.基于.net 2.0平台P$uT"fRc
2.MDAC2.7或更高的版本x si b]K j'Z3K7_
功能:FBvV;Q"nkK0`
根据区号、邮编查所在地
根据地区名称比名(广东东莞)/^s.E t$`5o
得到
所在地:区号:0769 邮编:511700
根据手机号查询手机所在地
开源 [:YUFS'N
这个代码的版本::$n0T6FQ5| Q9sFD
D+H!i2h1C[9P6xn
==============================T7V~|h#f ]
最新代码版本: :bate 1.0conn.csusing System;using System.Collections.Generic;using System.Text;using System.Data.OleDb;namespace LongRun_Find{ class Conn { private static Conn conn; private static string strConn=@";Provider=Microsoft.jet.OleDB.4.0; data Source=.\database\LongRun.mdb;Persist Security Info=False"; //@";Provider=Microsoft.jet.OleDB.4.0:database Password=2008iloveyou;data Source=./database/LongRun.mdb"; public static Conn Instance() { if (conn == null) { conn = new Conn(); } return conn; } public static OleDbConnection connAccess() { OleDbConnection OleDbconn = new OleDbConnection(strConn ); return OleDbconn; } } }from1.csusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace LongRun_Find{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void btnOk_Click(object sender, EventArgs e) { try { string strSql; string strInf; OperateAccess opa = new OperateAccess(); //查询生身证 if (rdrSfz.Checked == true) { strSql = "select DQ from sfz where bm=" + long.Parse(txtNumber.Text.Substring(0, 6)); strInf = (string)opa.GetValue(strSql); if (strInf != null) { txtInf.Text = "生份证所在地:" + strInf.Trim() + "\n"; } else { txtInf.Text = "您要查询的身份证不存在!"; } } //由区号查地区 if (rdrQh.Checked == true) { strSql = "select 省名+' '+县市名 from data where 区号='" + txtNumber.Text.Trim() + "'"; strInf = (string)opa.GetValue(strSql); if (strInf != null) { txtInf.Text = "区号所在地:" + strInf.Trim() + "\n"; } else { txtInf.Text = "您要查询的区号不存在!"; } } //由邮编查地区 if (rdrYb.Checked == true) { strSql = "select 省名+' '+县市名 from data where 邮编='" + txtNumber.Text.Trim() + "'"; strInf = (string)opa.GetValue(strSql); if (strInf != null) { txtInf.Text = "区号所在地:" + strInf.Trim() + "\n"; } else { txtInf.Text = "您要查询的邮编不存在!"; } } //由邮编查地区 if (rdrOther.Checked == true) { strSql = "select '区号:'+区号+' 邮编:'+邮编 from data where 省名+县市名='" + txtNumber.Text.Trim() + "'"; strInf = (string)opa.GetValue(strSql); if (strInf != null) { txtInf.Text = "所在地:" + strInf.Trim() + "\n"; } else { txtInf.Text = "您要查询的所在地不存在!"; } } //手机号查询 if (rdrSj.Checked == true) { strSql = "select 地区+城市+类型 from sj where 号码B<=" + long.Parse(txtNumber.Text.Substring(0, 7)) + " and 号码E>=" + long.Parse(txtNumber.Text.Substring(0, 7)); //strSql = "select '手机号所在地及类型:'+area+t from sj where num='" + txtNumber.Text.Substring(0, 8)+"'"; strInf = (string)opa.GetValue(strSql); if (strInf != null) { txtInf.Text = "手机号所在地及类型:" + strInf.Trim() + "\n"; } else { txtInf.Text = "您要查询的手机号不存在!"; } } } catch (Exception err) { MessageBox.Show("您输入的信息有误!"+err.Message); } } private void txtNumber_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar ==13) btnOk_Click(sender, e); } }}Form1.Designer.csnamespace LongRun_Find{ partial class Form1 { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.groupBox1 = new System.Windows.Forms.GroupBox(); this.rdrSj = new System.Windows.Forms.RadioButton(); this.rdrOther = new System.Windows.Forms.RadioButton(); this.rdrYb = new System.Windows.Forms.RadioButton(); this.rdrQh = new System.Windows.Forms.RadioButton(); this.rdrSfz = new System.Windows.Forms.RadioButton(); this.btnOk = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.txtNumber = new System.Windows.Forms.TextBox(); this.txtInf = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Controls.Add(this.rdrSj); this.groupBox1.Controls.Add(this.rdrOther); this.groupBox1.Controls.Add(this.rdrYb); this.groupBox1.Controls.Add(this.rdrQh); this.groupBox1.Controls.Add(this.rdrSfz); this.groupBox1.Font = new System.Drawing.Font("宋体", 11F); this.groupBox1.Location = new System.Drawing.Point(9, 1); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(533, 48); this.groupBox1.TabIndex = 0; this.groupBox1.TabStop = false; this.groupBox1.Text = "查询选项"; // // rdrSj // this.rdrSj.AutoSize = true; this.rdrSj.Location = new System.Drawing.Point(467, 20); this.rdrSj.Name = "rdrSj"; this.rdrSj.Size = new System.Drawing.Size(55, 19); this.rdrSj.TabIndex = 4; this.rdrSj.TabStop = true; this.rdrSj.Text = "手机"; this.rdrSj.UseVisualStyleBackColor = true; // // rdrOther // this.rdrOther.AutoSize = true; this.rdrOther.Location = new System.Drawing.Point(331, 20); this.rdrOther.Name = "rdrOther"; this.rdrOther.Size = new System.Drawing.Size(130, 19); this.rdrOther.TabIndex = 3; this.rdrOther.TabStop = true; this.rdrOther.Text = "由地区名查其它"; this.rdrOther.UseVisualStyleBackColor = true; // // rdrYb // this.rdrYb.AutoSize = true; this.rdrYb.Location = new System.Drawing.Point(220, 20); this.rdrYb.Name = "rdrYb"; this.rdrYb.Size = new System.Drawing.Size(115, 19); this.rdrYb.TabIndex = 2; this.rdrYb.TabStop = true; this.rdrYb.Text = "由邮编查地区"; this.rdrYb.UseVisualStyleBackColor = true; // // rdrQh // this.rdrQh.AutoSize = true; this.rdrQh.Location = new System.Drawing.Point(104, 20); this.rdrQh.Name = "rdrQh"; this.rdrQh.Size = new System.Drawing.Size(115, 19); this.rdrQh.TabIndex = 1; this.rdrQh.TabStop = true; this.rdrQh.Text = "由区号查地区"; this.rdrQh.UseVisualStyleBackColor = true; // // rdrSfz // this.rdrSfz.AutoSize = true; this.rdrSfz.Location = new System.Drawing.Point(6, 20); this.rdrSfz.Name = "rdrSfz"; this.rdrSfz.Size = new System.Drawing.Size(100, 19); this.rdrSfz.TabIndex = 0; this.rdrSfz.TabStop = true; this.rdrSfz.Text = "身份证查询"; this.rdrSfz.UseVisualStyleBackColor = true; // // btnOk // this.btnOk.Font = new System.Drawing.Font("宋体", 11F); this.btnOk.Location = new System.Drawing.Point(411, 55); this.btnOk.Name = "btnOk"; this.btnOk.Size = new System.Drawing.Size(131, 37); this.btnOk.TabIndex = 1; this.btnOk.Text = "查询"; this.btnOk.UseVisualStyleBackColor = true; this.btnOk.Click += new System.EventHandler(this.btnOk_Click); // // label1 // this.label1.AutoSize = true; this.label1.Font = new System.Drawing.Font("宋体", 11F); this.label1.Location = new System.Drawing.Point(9, 70); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(37, 15); this.label1.TabIndex = 2; this.label1.Text = "号码"; // // txtNumber // this.txtNumber.BackColor = System.Drawing.Color.Bisque; this.txtNumber.Font = new System.Drawing.Font("宋体", 14F); this.txtNumber.ForeColor = System.Drawing.Color.Blue; this.txtNumber.Location = new System.Drawing.Point(52, 61); this.txtNumber.Name = "txtNumber"; this.txtNumber.Size = new System.Drawing.Size(353, 29); this.txtNumber.TabIndex = 3; this.txtNumber.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtNumber_KeyPress); // // txtInf // this.txtInf.BackColor = System.Drawing.SystemColors.Info; this.txtInf.Font = new System.Drawing.Font("宋体", 12F); this.txtInf.Location = new System.Drawing.Point(9, 98); this.txtInf.Multiline = true; this.txtInf.Name = "txtInf"; this.txtInf.Size = new System.Drawing.Size(533, 121); this.txtInf.TabIndex = 4; // // label2 // this.label2.AutoSize = true; this.label2.ForeColor = System.Drawing.Color.Blue; this.label2.Location = new System.Drawing.Point(7, 235); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(221, 36); this.label2.TabIndex = 5; this.label2.Text = "本程序由李禄远所写,欢迎大家免费使用\r\n联系方式:QQ:65793574\r\nMSN:liluyuan@hotmail.com"; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.LightSkyBlue; this.ClientSize = new System.Drawing.Size(549, 279); this.Controls.Add(this.label2); this.Controls.Add(this.txtInf); this.Controls.Add(this.txtNumber); this.Controls.Add(this.label1); this.Controls.Add(this.btnOk); this.Controls.Add(this.groupBox1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MaximizeBox = false; this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "身份证 区号 邮编 手机号查询"; this.Load += new System.EventHandler(this.Form1_Load); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.Button btnOk; private System.Windows.Forms.RadioButton rdrSfz; private System.Windows.Forms.RadioButton rdrYb; private System.Windows.Forms.RadioButton rdrQh; private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox txtNumber; private System.Windows.Forms.TextBox txtInf; private System.Windows.Forms.Label label2; private System.Windows.Forms.RadioButton rdrOther; private System.Windows.Forms.RadioButton rdrSj; }}OperateAccess.csusing System;using System.Data;using System.Data.OleDb;/// <summary>/// OperateAccess 的摘要说明/// </summary>namespace LongRun_Find{ public class OperateAccess { //string strConString; OleDbConnection conn; public OperateAccess() { // // TODO: 在此处添加构造函数逻辑 // } //通过查询语句,返回要统计的值 public object GetValue(string strSql) { //try //{ OleDbConnection dbconn = Conn.connAccess(); dbconn.Open(); OleDbCommand dbcomm = new OleDbCommand(strSql, dbconn); return (object)dbcomm.ExecuteScalar(); //} //catch //{ // return null; //} //finally //{ //} } //通过查询语句,返回Dataset public static DataSet GetDateSet(string strSql) { //try //{ //string strConn; OleDbConnection dbconn = Conn.connAccess(); //定义sql 查询语名 OleDbCommand dbcomm = new OleDbCommand(); dbcomm.Connection = dbconn; dbcomm.CommandType = CommandType.Text; dbcomm.CommandText = strSql; //创建sqlDataAdapter OleDbDataAdapter dataAdpter = new OleDbDataAdapter(dbcomm); DataSet ds = new DataSet(); dataAdpter.Fill(ds); return ds; //} //catch //{ // return null; //} } public OleDbDataReader ExecuteReader(string cmdText) { //创建一个SqlCommand对象 //SqlCommand cmd = new SqlCommand(); //创建一个SqlConnection对象 conn = Conn.connAccess(); try { conn.Open(); OleDbCommand cmd = new OleDbCommand(cmdText, conn); OleDbDataReader rdr = cmd.ExecuteReader(); return rdr; } catch { //关闭数据库 conn.Close(); //throw; return null; } finally { conn.Close(); } } //执行插入和更新语句 public bool InserAndUpdate(string strSql) { OleDbCommand comm; conn = Conn.connAccess(); comm = new OleDbCommand(strSql, conn); try { conn.Open(); if (conn.State == ConnectionState.Open) { if (comm.ExecuteNonQuery() != -1) { return true; } else { return false; } } else { return false; } } catch { return false; } finally { conn.Close(); } } }}Program.csusing System;using System.Collections.Generic;using System.Windows.Forms;namespace LongRun_Find{ static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } }}//数据库不知怎么传,如果想要的朋友就到发邮件给我[email]liluyuan@foxmail.com[/email]
页:
[1]