用ASP.NET写你自己的代码生成器(14) #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();