sqlConnect();
string strsql = "select shengshi as 省市名称,xianshi as 县市名称, quxian as 区县名称,custormid as 客户编号,kehuname as 客户名称,kehudizhi as 地址,youbian as 邮编,bumen as 部门,officetp as 办公室电话,chuanzhen as 传真,kehu_mail as 客户邮箱,website as 网址,kehutype as 客户类型,kehudata as 创建日期 from kehu where custormid between " + textBox1.Text + "and " + textBox2.Text + "";
SqlCommand cmd = new SqlCommand(strsql, conn);
if (cmd.ExecuteScalar() == null)
{
MessageBox.Show("查无资料");
return;
}
else
{
SqlDataAdapter ad = new SqlDataAdapter(cmd);
DataSet sd = new DataSet();
ad.Fill(sd);
GridView1.DataSource = sd.Tables[0];
button2.Enabled = true;
}