版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
C#自动代码生成器自动生成数据表和实体类S4E茹印2Uii-ii-iaLr,运.L'a-fk£-uci:">lme」hdKtlu,U/"JfcZItiLkl41PaJL・d£namespaceSQLApplicationAutoGeneratiTool(publicpartialclassForml:Formstring[]strArray={"int","string","decimal","bool","char","object","double","float","DateTime"};类文件\”;publicForm1()InitializeComponent();privatevoid新增文本框ToolStripMenuItem_Click(objectsender,EventArgse){ShengChengKongJian();privatevoidShengChengKongJian()ComboBoxcobm=newComboBox();for(inti=0;i<strArray.Count();i++){cobm.Items.Add(strArray[i]);}TextBoxtextbox=newTextBox();this.flowLayoutPanel1.Controls.Add(cobm);
this.flowLayoutPanel2.Controls.Add(textbox);)StringBuilderstbd=null;List<StringBuilder>strbldList=newList<StringBuilder>();privatevoidbutton1_Click(objectsender,EventArgse){if(comboBox1.Text.Trim()==""){MessageBox.Show("类名不能为空");return;)stbd=newStringBuilder("usingSystem;");strbldList.Add(stbd);stbd=newStringBuilder("usingSystem.Collections.Generic;");strbldList.Add(stbd);stbd=newStringBuilder("usingSystem.Linq;");strbldList.Add(stbd);stbd=newStringBuilder("usingSystem.Text;");strbldList.Add(stbd);stbd=newStringBuilder("usingSystem.Data;");strbldList.Add(stbd);stbd=newStringBuilder("usingSystem.Data.SqlClient;");strbldList.Add(stbd);stbd=newStringBuilder("usingSystem.Windows.Forms;");strbldList.Add(stbd);stbd=newStringBuilder("namespaceHospitalInformationManagmentSystem");strbldList.Add(stbd);stbd=newStringBuilder("{");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder(版权信息,否则将追究相关责任");/*作者:大理大学软件教研室杜老师");*日期:"+dateTimePicker1.Text.Trim());*版权:大理大学");*你可以免费使用或修改以下代码,但请保留strbldList.Add(stbd);stbd=newStringBuilder("*/");strbldList.Add(stbd);stbd=newStringBuilder("publicclass");stbd.Append(comboBox1.Text.Trim());strbldList.Add(stbd);
stbd=newStringBuilder("{");strbldList.Add(stbd);stbd=newStringBuilder("#region属性");strbldList.Add(stbd);for(inti=0;i<flowLayoutPanel1.Controls.Count;i++){StringBuilderstd=newStringBuilder("private");std.Append((flowLayoutPanel1.Controls[i]).Text.Trim());std.Append("");std.Append(flowLayoutPanel2.Controls[i].Text.Trim());std.Append(";");strbldList.Add(std);}stringshuX="";stringst="";strings1="";{shuX="for(inti=0;i<flowLayoutPanel1.Controls.Count;i++){shuX="public"+flowLayoutPanel1.Controls[i].Text.Trim()+"_"+flowLayoutPanel2.Controls[i].Text.Trim();set{"+flowLayoutPanel2.Controls[i].Text.Trim()+"=value;}";s1="";}";stbd=newStringBuilder(shuX);strbldList.Add(stbd);s1="";}";stbd=newStringBuilder(shuX);strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder(st);strbldList.Add(stbd);stbd=newStringBuilder(s1);strbldList.Add(stbd);stbd=newStringBuilder("get{return"+flowLayoutPanel2.Controls[i].Text.Trim()+{");}");strbldList.Add(stbd);}stbd=newStringBuilder("#endregion属性");strbldList.Add(stbd);stbd=newStringBuilder("HIMSSqlConnectionsqlcon=newHIMSSqlConnection();");strbldList.Add(stbd);stbd=newStringBuilder("〃/〈summary〉");strbldList.Add(stbd);stbd=newStringBuilder("〃/增加一条记录");strbldList.Add(stbd);stbd=newStringBuilder("〃/〈/summary〉");strbldList.Add(stbd);
stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("sqlcon.DataBaseConnection())");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("{");inti=0;");using(SqlConnectioncon={");if(con.State==ConnectionState.Closed)");{");con.Open();");}");try");{");StringBuilderstrSql=newStringBuilder();");strSql.Append(\"insertinto");stbd.Append(comboBox1.Text.Trim());stbd.Append("(");for(inti=1;i<flowLayoutPanel2.Controls.Count;i++){if(i!=flowLayoutPanel2.Controls.Count-1){stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append(",");else{stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());}}stbd.Append(")");stbd.Append("values(");for(inti=1;i<flowLayoutPanel2.Controls.Count;i++)(if(i!=flowLayoutPanel2.Controls.Count-1)(stbd.Append("@");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append(",");}else(stbd.Append("@");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());}}stbd.Append(")\");");strbldList.Add(stbd);stbd=newStringBuilder("SqlCommandsqlCmd=newSqlCommand(strSql.ToString(),con);");strbldList.Add(stbd);stbd=newStringBuilder("SqlParameter口parameters={");for(inti=1;i<flowLayoutPanel2.Controls.Count;i++){if(i!=flowLayoutPanel2.Controls.Count-1){stbd.Append("newSqlParameter(\"@");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append("\"");stbd.Append(",");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append(")");stbd.Append(",");}else{stbd.Append("newSqlParameter(\"@");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append("\"");stbd.Append(",");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append(")};");}}strbldList.Add(stbd);stbd=newStringBuilder("foreach(SqlParameterparameterin
parameters)");strbldList.Add(stbd);parameters)");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);sqlCmd.Parameters.Add(parameter);");}");i=sqlCmd.ExecuteNonQuery();");}");catch(Exceptionex)");{");stbd=newStringBuilder("MessageBox.Show(\"错误:\"+ex.Message,\"错误提示\",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("finally");{");if(con.State==ConnectionState.Open)");{");con.Close();");con.Dispose();");}");}");if(i>0)");{");returntrue;");}");
strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);else");{");returnfalse;");}");}");}");〃/〈summary〉");stbd=newStringBuilder(〃/更新一条数据");stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("sqlcon.DataBaseConnection())");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("publicboolUpdate()");{");inti=0;");using(SqlConnectioncon={");if(con.State==ConnectionState.Closed)");{");con.Open();");}");try");{");StringBuilderstrSql=newStringBuilder();");strbldList.Add(stbd);stbd=newStringBuilder("strSql.Append(\"update"+comboBox1.Text.Trim()+"set");for(inti=1;i<flowLayoutPanel2.Controls.Count;i++){if(i!=flowLayoutPanel2.Controls.Count-1){stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append("=@");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append(",");}else{stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append("=@");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append("where");stbd.Append(flowLayoutPanel2.Controls[0].Text.Trim());stbd.Append("=\"+");stbd.Append(flowLayoutPanel2.Controls[0].Text.Trim());stbd.Append(");");}}strbldList.Add(stbd);stbd=newStringBuilder("SqlCommandsqlCmd=newSqlCommand(strSql.ToString(),con);");strbldList.Add(stbd);stbd=newStringBuilder("SqlParameter口parameters={");for(inti=1;i<flowLayoutPanel2.Controls.Count;i++){if(i!=flowLayoutPanel2.Controls.Count-1){stbd.Append("newSqlParameter(\"@");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append("\"");stbd.Append(",");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append(")");stbd.Append(",");}else{stbd.Append("newSqlParameter(\"@");
stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append("\"");stbd.Append(",");stbd.Append(flowLayoutPanel2.Controls[i].Text.Trim());stbd.Append(")};");}}strbldList.Add(stbd);stbd=newStringBuilder("parameters)");stbd.Append(")};");}}strbldList.Add(stbd);stbd=newStringBuilder("parameters)");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("{");sqlCmd.Parameters.Add(parameter);");}");i=sqlCmd.ExecuteNonQuery();");}");catch(Exceptionex)");{");MessageBox.Show(\"错误:\"+ex.Message,\"错误提示\",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);finally");{");if(con.State==ConnectionState.Open)");{");con.Close();");con.Dispose();");}");
stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);//数据查询}");if(i>0)");{");returntrue;");}");else");{");returnfalse;");}");}");}");stbd=newStringBuilder("///〈summary〉");strbldList.Add(stbd);stbd=newStringBuilder("///数据查询");strbldList.Add(stbd);///</summary>");stbd=newStringBuilder(strbldList.Add(stbd);///</summary>");stbd=newStringBuilder(///<paramname=\"queryWhere\">查询条件</param>");strbldList.Add(stbd);</param>");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder('sqlcon.DataBaseConnection())");strbldList.Add(stbd);stbd=newStringBuilder("con=///<returns>DataSet</returns>");publicDataSetSelect(stringqueryWhere)");{");DataSetds=newDataSet();");using(SqlConnection{");
strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("comboBox1.Text.Trim()+"\");");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("queryWhere);");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("SqlDataAdapter(strSql.ToString(),con);");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("{");con.Open();");}");try");{");StringBuilderstrSql=newStringBuilder();");strSql.Append(\"select*\");");strSql.Append(\"FROM"+if(queryWhere.Trim()!=\"\")");{");strSql.Append(\"where\"+}");SqlDataAdaptersqlda=newsqlda.Fill(ds);");}");catch(Exceptionex)");{");MessageBox.Show(\"错误:\"+ex.Message,\"错误提示\",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);");strbldList.Add(stbd);}");stbd=newStringBuilder(
}");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);//删除一条记录stbd=newStringBuilder("{");if(con.State==ConnectionState.Open)");{");con.Close();");con.Dispose();");}");}");}");returnds;");}");///〈///〈summary>");stbd=newStringBuilder("///删除一条记录");strbldList.Add(stbd);stbd=newStringBuilder("///〈/summary〉");strbldList.Add(stbd);stbdnewStringBuilder(///<paramname=\""flowLayoutPanel2.Controls[0].Text.Trim()+"\">主键</param>");newStringBuilder(///<paramname=\""strbldList.Add(stbd);stbd=newStringBuilder("flowLayoutPanel2.Controls[0].Text.Trim()+")");strbldList.Add(stbd);stbd=newStringBuilder("{");strbldList.Add(stbd);stbd=newStringBuilder("sqlcon.DataBaseConnection())");strbldList.Add(stbd);stbd=newStringBuilder("{");strbldList.Add(stbd);stbd=newStringBuilder(publicboolDelete(intusing(SqlConnectionconintrow=0;");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder(con);");strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(strbldList.Add(stbd);stbd=newStringBuilder(if(con.State==ConnectionState.Closed)");{");con.Open();");}");try");{");stbd=newStringBuilder("stringsql=\"DeleteFrom"+comboBox1.Text.Trim()+"Where"+flowLayoutPanel2.Controls[0].Text.Trim()+"=\"+\"'\"+"+flowLayoutPanel2.Controls[0].Text.Trim()+"+\"'\";");SqlCommandsqlCmd=newSqlCommand(sql,row=sqlCmd.ExecuteNonQuery();");}");catch(Exceptionex)");{");stbd=newStringBuilder("MessageBox.Show(\"错误:\"+ex.Message,\"错误提示\",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);");}");finally");{");if(con.State==ConnectionState.Open)");{");con.Close();");con.Dispose();");
strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);}");}");if(row>0)");{");returntrue;");}");else");{");returnfalse;");}");}");}");〃/〈summary〉");stbd=newStringBuilder(strbldList.Add(stbd);〃/返回一个sqlReader阅读器");strbldList.Add(stbd);stbd=newStringBuilder("〃/<paramname=\"queryWhere\">查询条件</param>");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder(queryWhere)");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder(queryWhere)");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("publicSqlDataReaderReturnSqlDataReader(string{");SqlDataReadersqlDataReader=null;");SqlConnectioncon=sqlcon.DataBaseConnection();");
strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder(""\");");strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbd=newStringBuilder("strbldList.Add(stbd);stbdnewStringBuilder("{");con.Open();");}");try");{");StringBuilderstrSql=newStringBuilder();");strSql.Append(\"select*\");");strSql.Append(\"FROM"+comboBox1.Text.Trim()+if(queryWhere.Trim()!=\"\")");{");strSql.Append(\"where\"+queryWhere);");}");SqlCommandsqlCmd=newSqlCommand(strSql.ToString(),con);");strbldList.Add(stbd);stbd=newStringBuilder("sqlDataReader=sqlCmd.ExecuteReader();");strbldList.Add(stbd);stbd=newStringBuilder("}");strbldList.Add(stbd);stbd=newStringBuilder(catch(Exceptionex)");strbldList.Add(stbd);catch(Exceptionex)");stbd=newStringBuilder("{");strbldList.Add(stbd);stbd=newStringBuilder("MessageBox.Show(\"错误:\"+ex.Message,\"错误提示\",MessageBoxButtons.OKCancel,MessageBoxIcon.Error);");strbldList.Add(stbd);}");stbd=newStringBuilder(strbldList.Add(stbd);}");returnsqlDataReader;");stbd=newStringBuilder("strbldList.Add(stbd);returnsqlDataReader;");stbd=newStringBuilder("}");strbldList.Add(stbd);stbd=newStringBuilder("}");strbldList.Add(stbd);stbd=newStringBuilder("}");strbldList.Add(stbd);//从这里开始//stbd=newStringBuilder("}");//strbldList.Add(stbd);//stbd=newStringBuilder("}");//strbldList.Add(stbd);stbd=newStringBuilder("");strbldList.Add(stbd);stbd=newStringBuilder("");strbldList.Add(stbd);stbd=newStringBuilder("");strbldList.Add(stbd);stbd=newStringBuilder("");strbldList.Add(stbd);stbd=newStringBuilder("");strbldList.Add(stbd);stbd=newStringBuilder("");strbldList.Add(stbd);stbd=newStringBuilder("");strbldList.Add(stbd);stbd=newStringBuilder("");strbldList.Add(stbd);FileStreamfs=newFileStream(path+comboBox1.Text.Trim()+".cs",FileMode.Create,FileAccess.Write);StreamWriterstreamWriter=newStreamWriter(fs);for(inti=0;i<strbldList.Count();i++){streamWriter.WriteLine(strbldList[i].ToString());richTextBox1.Text=richTextBox1.Text+strbldList[i].ToString()+"\n";}streamWriter.Flush();streamWriter.Close();//存储字段类型fs=newFileStream(path+comboBox1.Text.Trim()+"LeiXing.txt",FileMode.Create,FileAccess.Write);streamWriter=newStreamWriter(fs);for(inti=0;i<flowLayoutPanell.Controls.Count;i++)(streamWriter.WriteLine(flowLayoutPanel1.Controls[i].Text.Trim());)streamWriter.Flush();streamWriter.Close();//存储字段名称fs=newFileStream(path+comboBox1.Text.Trim()+"Ming.txt",FileMode.Create,FileAccess.Write);streamWriter=newStreamWriter(fs);for(inti=0;i<flowLayoutPanel2.Controls.Count;i++)(streamWriter.WriteLine(flowLayoutPanel2.Controls[i].Text.Trim());)streamWriter.Flush();streamWriter.Close();//存储字段数fs=newFileStream(path+comboBox1.Text.Trim()+"Count.txt",FileMode.Create,FileAccess.Write);streamWriter=newStreamWriter(fs);streamWriter.WriteLine(flowLayoutPanel2.Controls.Count.ToString());streamWriter.Flush();streamWriter.Close();)privatevoidbutton2_Click(objectsender,EventArgse)(DirectoryInfofolder=newDirectoryInfo(path);string[]sArray;foreach(FileInfofileinfolder.GetFiles("*.cs"))(sArray=file.Name.Split('.');comboBox1.Items.Add(sArray[0].ToString());))privatevoidbutton3_Click(objectsender,EventArgse)(FileStreamfs=newFileStream(path+comboBox1.Text.Trim()+"Count.txt",FileMode.Open,FileAccess.Read);StreamReaderstreamReader=newStreamReader(fs);stringstrLine=streamReader.ReadLine();for(inti=0;i<int.Parse(strLine);i++)(ShengChengKongJian();
)fs=newFileStream(path+comboBox1.Text.Trim()+"LeiXing.txt",FileMode.Open,FileAccess.Read);streamReader=newStreamReader(fs);strLine=streamReader.ReadLine();List<string>stList=newList<string>();while(strLine!=null
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 山西省2020年中考数学真题试卷(含答案)
- 保定学院《初等数论》2023-2024学年第一学期期末试卷
- 宝鸡文理学院《幼儿园美术》2021-2022学年第一学期期末试卷
- 保定学院《标志与字体设计》2021-2022学年第一学期期末试卷
- 新课标2023版高考地理一轮检测二十二海水运动和海-气相互作用
- 智能戒指数据处理项目可行性实施报告
- 宝鸡文理学院《曲式与作品分析》2021-2022学年第一学期期末试卷
- 复苏器项目可行性实施报告
- 【初中英语】100句经典名言帮你梳理100个英语语法
- 工业用破碎机相关项目实施方案
- FZ/T 93048.2-2021针刺机用针第2部分:叉形针
- 2023年北京地区成人本科学士学位英语考试真题及参考答案
- 运输供应商年度评价表
- 危险化学品双重预防机制培训课件
- 论民间小儿关煞与化解
- 消防安全宣传培训制度(5篇)
- 冲压工艺培训学习资料(非常全面)课件
- 大豆介绍及病虫害课件
- 消费税会计存在的问题及改进
- 企业家刑事法律风险及其防范(课件)
- 传承·创新·引领:共同体推动语文课堂教学改革探索
评论
0/150
提交评论