日期:2009-04-01  浏览次数:20502 次

#region Make Form
        /// <summary>

        /// 生成表单项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button3_Click(object sender, System.EventArgs e)
        {
            if(this.DropDownList1.SelectedIndex!=-1)
            {
                m_Scon.ConnectionString = "user id="+this.txtUserName.Text+
                    ";password="+this.txtPassword.Text+
                    ";initial catalog="+this.DropDownList3.SelectedItem.Text+
                    ";data source="+this.txtServerName.Text;
                SqlCommand m_Scmd = new SqlCommand("sp_columns",m_Scon);
                m_Scmd.CommandType = CommandType.StoredProcedure;
                SqlParameter myParm = m_Scmd.Parameters.Add("@table_name",SqlDbType.VarChar,100);
                myParm.Value = this.DropDownList1.SelectedItem.Value;
                m_Scon.Open();
                SqlDataReader m_Sdr = m_Scmd.ExecuteReader();
                string ColName = "";
                string ColType = "";
                while(m_Sdr.Read())
                {
                    ColName = m_Sdr["COLUMN_NAME"].ToString();
                    ColType = m_Sdr["TYPE_NAME"].ToString();
                }
                m_Sdr.Close();
                m_Scon.Close();
            }
        }
        #endregion

   &nb