小代码2
LBCRM.BLL.Client bll = new LBCRM.BLL.Client();
LBCRM.Model.Client model = new LBCRM.Model.Client();
model.Client_Name = txtCustomerName.Text.Trim();
model.Client_Addr = txtCustomerAddress.Text.Trim();
model.Client_Phone = txtCustomerPhone.Text.Trim();
model.Client_Fax = txtCustomerFax.Text.Trim();
model.Client_Email = txtCustomerEmail.Text.Trim();
model.Client_Web = txtCustomerWeb.Text.Trim();
model.Client_Intr = txtCustomerIntro.Text.Trim();
model.Client_Way = ddlIndustry.SelectedValue;
model.Client_Province = DropDownList2.SelectedValue;
model.Client_City = DropDownList3.SelectedValue;
model.Exp3 = DropDownList4.SelectedValue;
if (bll.Add(model) > 0)
{
MsgBox.Show(this, "添加客户成功!");
Response.Redirect("http://www.sina.com.cn");
}
else
{
MsgBox.Show(this,"添加客户失败!");
}
工具->选项->HTML设计器->CSS定位->绝对定位
this.GridView1.PageIndex = e.NewPageIndex;
string th = LookUptx1.Text;
string tb = LookUptx2.Text;
DataTable dt = DbHelperSQL.Query("select Client_Name,Client_Phone,Client_Addr from Client where Client_Name='th' or Client_Phone like '%" + tb + "%'").Tables[0];
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
DataTable dt = DbHelperSQL.Query("select Client_Name,Client_Phone,Client_Addr from Client").Tables[0];
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
namespace CRM.LBCRMF.ClientManage
{
public partial class QzCustomer : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DataTable dt = DbHelperSQL.Query("select Client_Name,Client_Phone,Client_Addr from Client").Tables[0];
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
string th = LookUptx1.Text;
string tb = LookUptx2.Text;
DataTable dt = DbHelperSQL.Query("select Client_Name,Client_Phone,Client_Addr from Client where Client_Name='th' or Client_Phone like '%" + tb + "%'").Tables[0];
this.GridView1.DataSource = dt;
this.GridView1.DataBind();
}
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
}
}
}
设置表格的css样式:
border:solid 1px;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Chap9_3
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void txtPassword_Validating(object sender, CancelEventArgs e)
{
if (txtPassword.Text.Trim() == string.Empty)
{
MessageBox.Show("密码为空,请重新输入!");
txtPassword.Focus();
}
}
private void txtName_Validating(object sender, CancelEventArgs e)
{
if (txtName.Text.Trim() == string.Empty)
{
MessageBox.Show("用户名为空,请重新输入!");
txtName.Focus();
}
}
private void txtAgain_Validating(object sender, CancelEventArgs e)
{
//验证第二次输入的密码是否为空
//如不为空是否与第一次输入的密码相同
//如不相同则清空,重新输入
if (txtAgain.Text.Trim() == string.Empty)
{
MessageBox.Show("密码为空,请重新输入!");
txtAgain.Focus();
}
else if (txtAgain.Text.Trim() != txtPassword.Text.Trim())
{
MessageBox.Show("密码输入有误,请重新输入!");
txtPassword.Clear();
txtAgain.Clear();
txtPassword.Focus();
}
}
private void txtGender_Validating(object sender, CancelEventArgs e)
{
//判断txtGender中输入的内容是否为“男”或“女”
if ((txtGender.Text.Trim() != "男") && (txtGender.Text.Trim() != "女"))
{
MessageBox.Show("性别输入不正确,请重新输入!");
txtGender.SelectAll();
txtGender.Focus();
}
}
private void txtName_Enter(object sender, EventArgs e)
{
txtHelp.Text = "请输入您的姓名!";
}
private void txtPassword_Enter(object sender, EventArgs e)
{
txtHelp.Text = "请输入您的密码!";
}
private void txtAgain_Enter(object sender, EventArgs e)
{
txtHelp.Text = "请再次输入您的密码!";
}
private void txtGender_Enter(object sender, EventArgs e)
{
txtHelp.Text = "请输入您的性别!";
}
private void txtAddress_Enter(object sender, EventArgs e)
{
txtHelp.Text = "请输入您的地址!";
}
}
}
好久没注意这个问题啦 算啦 问这样问题的都很菜的 请各位大哥们就不要用什么术语啦 谢谢 不知道在哪里找来的答案 贴上来了
protected void check_Click(object sender, EventArgs e)
{
Regex myRex = new Regex("^[A-Za-z]+$");
string s = LoginT.Text;
//IsMatch m = myRex.IsMatch(s);
if (!myRex.IsMatch(LoginT.Text))
{
Response.Write("<script>alert('你输入的用户名非法');</script>");
return;
}
string usename = Request["LoginT"];
string cmdtxt1 = "Server=5AB2D5A75C66462\\SQLEXPRESS;Database=Student;Integrated Security=SSPI";
SqlConnection Con = new SqlConnection(cmdtxt1);
Con.Open();
SqlCommand scom = new SqlCommand("Select count(*) from student where usename='" + usename + "'", Con);
int count = Convert.ToInt32(scom.ExecuteScalar());
if (count > 0)
{
Response.Write("<script>alert('用户名已经被注册,请重心输入用户名!');</script>");
}
else
{
Response.Write("<script>alert('这个用户名可以注册');</script>");
}
Con.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{
string user = this.LoginT.Text.Trim().ToString();
string pwd=this.PWT.Text.Trim().ToString();
if (PWT.Text.ToString() != TextBox2.Text.ToString())
{
Response.Write("<script>alert('密码不一致,请重新输入');</script>");
return;
}
if (PWT.Text.Length < 5)
{
Response.Write("<script>alert('请输入大于五位的密码');</script>");
return;
}
"INSERT INTO [td_Account] ([AccountName],[Password],[AccountType],[RegisteredDate],[LastLoginDate],[IsBlocked],[ChattingBlocked],[MGameEventType],[ConnectingServerGroupID],[GameContinueTimeInSecondOfToday],[LastGameEndDate]) VALUES ('" + U_Name.Text + "','" + U_Pass.Text + "','0',getdate(),getdate(),'0','0','0','0','3638',getdate())"
insert into table_name (column1,column2,。。) values (value1,value2,。。)
<a href="url">链接的显示文字</a> select @@version查询您SQL版本 hnhyjzbsd
//如果数据校验成功
//创建对象
LBCRM.BLL.Client bll = new LBCRM.BLL.Client();
LBCRM.Model.Client model = new LBCRM.Model.Client();
//实体赋值
model.Client_Addr = txtCustomerAddress.Text.Trim();
model.Client_City = "";
//.......
//执行操作
if (bll.Add(model) > 0)
{
MsgBox.Show(this, "OK!");
}
else
{
MsgBox.Show(this, "Errow!");
}
{
int[] array = new int[5]; //定义一个一维数组,它有5个元素
for (int i = 0; i < array.Length; i++) //循环计算i的值,最大长度是数组的长度array.Length
{
array[i] = i + 10;
Console.WriteLine(array[i]); //输出i的值
}
Console.ReadLine(); //获取输入焦点,为了看运行结果,放在循环体之外