WEBFORM上与数据库交互时产生的有关问题
WEBFORM上与数据库交互时产生的问题
protected void Page_Load(object sender, EventArgs e)
{
Session[ID] = 1008;
string selectStr = "select * from Basics_information where id='" + Session[ID] + "'";
SqlDataReader read = sd.ExceRead(selectStr);
read.Read();
if (read.HasRows)
{
if (Convert.ToInt32(read["IsUpdate"]) == 3||Convert.ToInt32(read["IsUpdate"])==2)
{
Label14.Visible = true;
TextBox1.Visible = true;
FirstName.Text = read["First_Name"].ToString();
LastName.Text = read["Last_Name"].ToString();
Sex.SelectedValue = read["Sex"].ToString();
Address.Text = read["Address_VIP"].ToString();
TextBox1.Text = read["City"].ToString();
zipCode.Text = read["Zip_Code"].ToString();
CompanyName.Text = read["Company_Name"].ToString();
Intro.Text = read["Intro"].ToString();
Description.Text = read["Description"].ToString();
TextBox1.ReadOnly = true;
//isRdOnly = true;
//isReadOnly();
}
}
read.Close();
}
protected void submit(object sender, EventArgs e)
{
//if (isRdOnly)
//{
// isRdOnly = false;
//}
//else
//{
int isUpdate;//1为完全未填写,2为填写部分内容,3为填写完整
if (FirstName.Text != null || LastName.Text != null || Sex.Text != null || Address.Text != null || ddlCity.SelectedValue.ToString() != null || ddlProvince.SelectedValue.ToString() != null || CompanyName.Text != null || Intro.Text != null || Description.Text != null)
{
if (FirstName.Text != null && LastName.Text != null && Sex.Text != null && Address.Text != null && ddlCity.SelectedValue.ToString() != null && ddlProvince.SelectedValue.ToString() != null && CompanyName.Text != null && Intro.Text != null && Description.Text != null)
{ isUpdate = 3; }