using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
using System.Data.OleDb;
using System.Data.Odbc;namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();        }
       public static int ExcutSslet(string mysql)
       {
           conn.Open();
           OracleCommand command = new OracleCommand(mysql,conn);           int reulet = Convert.ToInt32(command.ExecuteNonQuery());
           conn.Close();           return reulet;
       }
              private void Form1_Load(object sender, EventArgs e)
        {
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "")
            {
                MessageBox.Show("请输入查询条件!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                return;
            }            int id = Convert.ToInt32(textBox1.Text);
            string sql = string.Format("select em_house_t.p_priv_flarea,em_house_t.p_co_flarea,em_house_t.p_ratial,em_house_t.p_flarea,em_house_t.FLAREA,em_house_t.PRIV_FLAREA,em_house_t.RATIAL,em_house_t.CO_FLAREA,em_house_t.FLAREA,em_location_t.LOCATION_NAME ,em_house_t.OLDLANDNUM from em_house_t,em_location_t,EM_FLAT_LOC_T" +
" where em_house_t.HOUSE_ID= em_flat_loc_t.HOUSE_ID and" +
" em_location_t.LOCATION_ID=em_flat_loc_t.LOCATION_ID and em_house_t.HOUSE_ID='{0}'", id);
            try
            {
                OracleDataReader dReader = DBHelp.ExcuterRead(sql);
                if (dReader.Read())
                {                    this.textBox2.Text = dReader["p_priv_flarea"].ToString();
                    this.textBox3.Text = dReader["p_co_flarea"].ToString();
                    this.textBox4.Text = dReader["p_ratial"].ToString();
                    this.textBox5.Text = dReader["p_flarea"].ToString();
                    this.textBox6.Text = dReader["PRIV_FLAREA"].ToString();
                    this.textBox7.Text = dReader["LOCATION_NAME"].ToString();
                    this.textBox8.Text = dReader["RATIAL"].ToString();
                    this.textBox9.Text = dReader["CO_FLAREA"].ToString();
                    this.textBox10.Text = dReader["FLAREA"].ToString();
                    this.textBox11.Text = dReader["OLDLANDNUM"].ToString();                }
                else
                {
                    MessageBox.Show("没有你要查找的数据", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }                dReader.Close();
            }
            catch (Exception ex)
            {                MessageBox.Show(ex.Message);
            }
            finally
            {
                DBHelp.conn.Close();
            }
        }        private void button2_Click(object sender, EventArgs e)
        {            if (textBox1.Text == "")
            {
                MessageBox.Show("没有要修改的信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);                return;
            }
            int id = Convert.ToInt32(textBox1.Text);
            string sql = string.Format("update em_house_t set PRIV_FLAREA='{0}',RATIAL='{1}',CO_FLAREA='{2}',FLAREA='{3}',p_priv_flarea='{4}',p_co_flarea='{5}',p_ratial='{6}',p_flarea='{7}',OLDLANDNUM='{8}'" +
"where house_id='{9}'", textBox6.Text, textBox8.Text, textBox9.Text, textBox10.Text, textBox2.Text, textBox3.Text, textBox4.Text, textBox5.Text, textBox11.Text, id);            try
            {
                int reulet = Int32.Parse(DBHelp.ExcutSslet(sql).ToString());
                if (reulet != 1)
                {
                    MessageBox.Show("修改失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                   // MessageBox.Show("修改成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
            finally
            {
               DBHelp.conn.Close();
            }            DBHelp.conn.Open();
            string sqll = string.Format("update (select /*+ BYPASS_UJVC */  location_name from  em_location_t,em_flat_loc_t,em_house_t   where em_house_t.HOUSE_ID= em_flat_loc_t.HOUSE_ID and em_location_t.LOCATION_ID=em_flat_loc_t.LOCATION_ID and em_house_t.HOUSE_ID='{0}')" +
"set LOCATION_NAME='{1}'", textBox1.Text, textBox7.Text);
            try
            {
               
                int reule = Int32.Parse(DBHelp.ExcutSslet(sqll).ToString());//  运行到这句就会死,程序无响应
                if (reule != 1)
                {
                    MessageBox.Show("修改失败!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("修改成功!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                DBHelp.conn.Close();
            }
        }    }
}它上面那跳修改语句是可以成功的下面那条sql  拿到数据库去也是可以执行成功的`` 就是不知道为什么到那语句程序就当机了````求高手``