public Form_Result(int Q_ID, int C_ID, Hashtable A_List_Score, Hashtable A_List_Text) { InitializeComponent(); Question_ID = Q_ID; ClientInfo_ID = C_ID; list_answerInfo_Score = A_List_Score; list_answerInfo_Text = A_List_Text; DataTable dt = null; Function_Question function_question = new Function_Question(); dt = function_question.Query_AnswerInfo(Question_ID); if (dt != null && dt.Rows.Count > 0) { label2.Text = dt.Rows[0]["Question_Title"].ToString(); } Function_ClientInfo function_clientInfo = new Function_ClientInfo(); dt = function_clientInfo.Query_ClientInfo(ClientInfo_ID); if (dt != null && dt.Rows.Count > 0) { class_clientInfo = new Class_ClientInfo(); class_clientInfo.ClientInfo_ID = Convert.ToInt32(dt.Rows[0]["ClientInfo_ID"].ToString()); class_clientInfo.ClientInfo_Name = dt.Rows[0]["ClientInfo_Name"].ToString(); class_clientInfo.ClientInfo_Age = Convert.ToUInt32(dt.Rows[0]["ClientInfo_Age"].ToString()); class_clientInfo.ClientInfo_Sex = dt.Rows[0]["ClientInfo_Sex"].ToString(); if (dt.Rows[0]["ClientInfo_Weight"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Weight"].ToString()) && CommonFunction.IsNumber(dt.Rows[0]["ClientInfo_Weight"].ToString(), 2)) class_clientInfo.ClientInfo_Weight = Convert.ToSingle(dt.Rows[0]["ClientInfo_Weight"].ToString()); if (dt.Rows[0]["ClientInfo_Height"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Height"].ToString()) && CommonFunction.IsNumber(dt.Rows[0]["ClientInfo_Height"].ToString(), 2)) class_clientInfo.ClientInfo_Height = Convert.ToSingle(dt.Rows[0]["ClientInfo_Height"].ToString()); if (dt.Rows[0]["ClientInfo_Province"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Province"].ToString())) class_clientInfo.ClientInfo_Province = dt.Rows[0]["ClientInfo_Province"].ToString(); if (dt.Rows[0]["ClientInfo_City"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_City"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_City"].ToString(); if (dt.Rows[0]["ClientInfo_Address"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Address"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_Address"].ToString(); if (dt.Rows[0]["ClientInfo_Tel"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Tel"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_Tel"].ToString(); if (dt.Rows[0]["ClientInfo_Email"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Email"].ToString())) class_clientInfo.ClientInfo_Email = dt.Rows[0]["ClientInfo_Email"].ToString(); if (dt.Rows[0]["ClientInfo_Zip"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Zip"].ToString())) class_clientInfo.ClientInfo_Zip = dt.Rows[0]["ClientInfo_Zip"].ToString(); if (dt.Rows[0]["AddTime"] != null && !String.IsNullOrEmpty(dt.Rows[0]["AddTime"].ToString())) class_clientInfo.AddTime = Convert.ToDateTime(dt.Rows[0]["AddTime"].ToString()); label5.Text += class_clientInfo.ClientInfo_ID.ToString(); label6.Text += class_clientInfo.ClientInfo_Name.ToString(); } }
private void choiButton1_Click(object sender, EventArgs e) { Class_ClientInfo class_clientInfo = new Class_ClientInfo(); if (!String.IsNullOrEmpty(choiTextBox1.Text) && CommonFunction.IsNumber(choiTextBox1.Text, 1)) class_clientInfo.ClientInfo_ID = Convert.ToInt32(choiTextBox1.Text); if (!String.IsNullOrEmpty(choiTextBox2.Text)) class_clientInfo.ClientInfo_Name = choiTextBox2.Text; if (!String.IsNullOrEmpty(choiTextBox3.Text) && CommonFunction.IsNumber(choiTextBox3.Text, 1)) class_clientInfo.ClientInfo_Age = Convert.ToUInt32(choiTextBox3.Text); if (choiRadioButton1.Checked) class_clientInfo.ClientInfo_Sex = "1"; if (choiRadioButton2.Checked) class_clientInfo.ClientInfo_Sex = "0"; if (!String.IsNullOrEmpty(choiTextBox4.Text) && CommonFunction.IsNumber(choiTextBox4.Text, 2)) class_clientInfo.ClientInfo_Weight = Convert.ToSingle(choiTextBox4.Text); if (!String.IsNullOrEmpty(choiTextBox5.Text) && CommonFunction.IsNumber(choiTextBox5.Text, 2)) class_clientInfo.ClientInfo_Height = Convert.ToSingle(choiTextBox5.Text); if (!String.IsNullOrEmpty(choiTextBox6.Text)) class_clientInfo.ClientInfo_Province = choiTextBox6.Text; if (!String.IsNullOrEmpty(choiTextBox7.Text)) class_clientInfo.ClientInfo_City = choiTextBox7.Text; if (!String.IsNullOrEmpty(choiTextBox8.Text)) class_clientInfo.ClientInfo_Address = choiTextBox8.Text; if (!String.IsNullOrEmpty(choiTextBox9.Text)) class_clientInfo.ClientInfo_Tel = choiTextBox9.Text; if (!String.IsNullOrEmpty(choiTextBox10.Text)) class_clientInfo.ClientInfo_Email = choiTextBox10.Text; if (!String.IsNullOrEmpty(choiTextBox11.Text)) class_clientInfo.ClientInfo_Zip = choiTextBox11.Text; Function_ClientInfo fc = new Function_ClientInfo(); ClientInfo_Table = fc.Query_ClientInfo(class_clientInfo); Close(); }
public void dataGridView_Refresh() { if (dataGridView1.Rows.Count > 0) { for (int i = 0; i < dataGridView1.Rows.Count; i++) { dataGridView1.Rows.RemoveAt(i); } } Function_ClientInfo function_clientInfo = new Function_ClientInfo(); DataTable dt = function_clientInfo.Query_ClientInfo(); if (dt != null) { dataGridView1.DataSource = dt; dataGridView_SetColumns(); } }
public void listView_Refresh() { listView1.Items.Clear(); Function_ClientInfo function_clientInfo = new Function_ClientInfo(); DataTable dt = function_clientInfo.Query_ClientInfo(); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { listView1.Items.Add(dt.Rows[i]["ClientInfo_ID"].ToString()); listView1.Items[i].SubItems.Add(dt.Rows[i]["ClientInfo_Name"].ToString()); } if (listView1.Items.Count > 0) { listView1.Items[0].Selected = true; } } }
public void Show_ClientDetail() { if (ClientInfo_ID > 0) { Function_ClientInfo function_clientInfo = new Function_ClientInfo(); DataTable dt = function_clientInfo.Query_ClientInfo(ClientInfo_ID); if (dt != null && dt.Rows.Count > 0) { label1.Visible = true; label2.Visible = true; label1.Text = dt.Rows[0]["ClientInfo_ID"].ToString(); choiTextBox1.Text = dt.Rows[0]["ClientInfo_Name"].ToString(); choiTextBox2.Text = dt.Rows[0]["ClientInfo_Age"].ToString(); if (dt.Rows[0]["ClientInfo_Sex"].ToString() == "1") { choiRadioButton1.Checked = true; choiRadioButton2.Checked = false; } else { choiRadioButton1.Checked = false; choiRadioButton2.Checked = true; } choiTextBox3.Text = dt.Rows[0]["ClientInfo_Weight"].ToString(); choiTextBox4.Text = dt.Rows[0]["ClientInfo_Height"].ToString(); choiTextBox5.Text = dt.Rows[0]["ClientInfo_Province"].ToString(); choiTextBox6.Text = dt.Rows[0]["ClientInfo_City"].ToString(); choiTextBox7.Text = dt.Rows[0]["ClientInfo_Address"].ToString(); choiTextBox8.Text = dt.Rows[0]["ClientInfo_Tel"].ToString(); choiTextBox9.Text = dt.Rows[0]["ClientInfo_Email"].ToString(); choiTextBox10.Text = dt.Rows[0]["ClientInfo_Zip"].ToString(); } } else { label1.Visible = false; label2.Visible = false; } }
public void Show_QuestionList() { //显示客户姓名和编号 Function_ClientInfo function_clientInfo = new Function_ClientInfo(); DataTable dt = function_clientInfo.Query_ClientInfo(ClientInfo_ID); if (dt != null && dt.Rows.Count > 0) { class_clientInfo = new Class_ClientInfo(); class_clientInfo.ClientInfo_ID = Convert.ToInt32(dt.Rows[0]["ClientInfo_ID"].ToString()); class_clientInfo.ClientInfo_Name = dt.Rows[0]["ClientInfo_Name"].ToString(); class_clientInfo.ClientInfo_Age = Convert.ToUInt32(dt.Rows[0]["ClientInfo_Age"].ToString()); class_clientInfo.ClientInfo_Sex = dt.Rows[0]["ClientInfo_Sex"].ToString(); if (dt.Rows[0]["ClientInfo_Weight"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Weight"].ToString()) && CommonFunction.IsNumber(dt.Rows[0]["ClientInfo_Weight"].ToString(), 2)) class_clientInfo.ClientInfo_Weight = Convert.ToSingle(dt.Rows[0]["ClientInfo_Weight"].ToString()); if (dt.Rows[0]["ClientInfo_Height"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Height"].ToString()) && CommonFunction.IsNumber(dt.Rows[0]["ClientInfo_Height"].ToString(), 2)) class_clientInfo.ClientInfo_Height = Convert.ToSingle(dt.Rows[0]["ClientInfo_Height"].ToString()); if (dt.Rows[0]["ClientInfo_Province"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Province"].ToString())) class_clientInfo.ClientInfo_Province = dt.Rows[0]["ClientInfo_Province"].ToString(); if (dt.Rows[0]["ClientInfo_City"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_City"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_City"].ToString(); if (dt.Rows[0]["ClientInfo_Address"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Address"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_Address"].ToString(); if (dt.Rows[0]["ClientInfo_Tel"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Tel"].ToString())) class_clientInfo.ClientInfo_City = dt.Rows[0]["ClientInfo_Tel"].ToString(); if (dt.Rows[0]["ClientInfo_Email"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Email"].ToString())) class_clientInfo.ClientInfo_Email = dt.Rows[0]["ClientInfo_Email"].ToString(); if (dt.Rows[0]["ClientInfo_Zip"] != null && !String.IsNullOrEmpty(dt.Rows[0]["ClientInfo_Zip"].ToString())) class_clientInfo.ClientInfo_Zip = dt.Rows[0]["ClientInfo_Zip"].ToString(); if (dt.Rows[0]["AddTime"] != null && !String.IsNullOrEmpty(dt.Rows[0]["AddTime"].ToString())) class_clientInfo.AddTime = Convert.ToDateTime(dt.Rows[0]["AddTime"].ToString()); label5.Text += class_clientInfo.ClientInfo_ID.ToString(); label6.Text += class_clientInfo.ClientInfo_Name.ToString(); } if (Question_ID > 0) { //显示题目名称和题目头 Function_Question function_question = new Function_Question(); dt = function_question.Query_AnswerInfo(Question_ID); if (dt != null && dt.Rows.Count > 0) { label2.Text = dt.Rows[0]["Question_Title"].ToString(); label4.Text = dt.Rows[0]["Question_Top"].ToString(); //flowLayoutPanel1.BorderStyle = BorderStyle.Fixed3D; flowLayoutPanel1.Controls.Add(label3); flowLayoutPanel1.Controls.Add(label4); flowLayoutPanel1.Height = label3.Height + label4.Height + 5; label5.Location = new Point(label5.Location.X, flowLayoutPanel1.Location.Y + flowLayoutPanel1.Height + 10); label6.Location = new Point(label6.Location.X, flowLayoutPanel1.Location.Y + flowLayoutPanel1.Height + 10); Panel_Height = label5.Location.Y + label5.Height + 10; } Function_AnswerInfo function_anwerInfo = new Function_AnswerInfo(); dt = function_anwerInfo.Query_AnswerInfo(ClientInfo_ID, Question_ID); if (dt != null && dt.Rows.Count > 0) { if (CommonFunction.IsNumber(dt.Rows[0]["AnswerInfo_ID"].ToString(), 0)) { AnswerInfo_ID = Convert.ToInt32(dt.Rows[0]["AnswerInfo_ID"].ToString()); Text_Question_Tail.Text = dt.Rows[0]["Question_Tail"].ToString(); } } Hashtable hash_answerList = new Hashtable(); if (AnswerInfo_ID > 0) { //读出每条答过的题目 Function_AnswerList function_answerList = new Function_AnswerList(); dt = function_answerList.Query_AnswerList(AnswerInfo_ID); if (dt != null && dt.Rows.Count > 0) { int QuestionList_ID = 0; for (int i = 0; i < dt.Rows.Count; i++) { if (QuestionList_ID != Convert.ToInt32(dt.Rows[i]["QuestionList_ID"].ToString())) { QuestionList_ID = Convert.ToInt32(dt.Rows[i]["QuestionList_ID"].ToString()); ArrayList list_questionSelect = new ArrayList(); list_questionSelect.Add(Convert.ToInt32(dt.Rows[i]["QuestionSelect_ID"].ToString())); hash_answerList.Add(QuestionList_ID, list_questionSelect); } else { ArrayList list_questionSelect = (ArrayList)hash_answerList[QuestionList_ID]; list_questionSelect.Add(Convert.ToInt32(dt.Rows[i]["QuestionSelect_ID"].ToString())); hash_answerList[QuestionList_ID] = list_questionSelect; } } } } //读出每条题目 Function_QuestionList function_questionList = new Function_QuestionList(); dt = function_questionList.Query_QuestionList(Question_ID); if (dt != null && dt.Rows.Count > 0) { ArrayList list_QuestionList = new ArrayList(); int j = -1; int QuestionList_Sequence = 0; for (int i = 0; i < dt.Rows.Count; i++) { int QuestionList_ID = Convert.ToInt32(dt.Rows[i]["QuestionList_ID"].ToString()); if (QuestionList_ID != QuestionList_Sequence) { Class_Question class_question = new Class_Question(); class_question.QuestionList_ListID = Convert.ToInt32(dt.Rows[i]["QuestionList_ListID"].ToString()); ; class_question.QuestionList_ID = QuestionList_ID; class_question.Question_Title = dt.Rows[i]["QuestionList_Title"].ToString(); class_question.Question_Option = Convert.ToInt32(dt.Rows[i]["QuestionList_Option"].ToString()); class_question.Question_TurnRow = Convert.ToInt32(dt.Rows[i]["QuestionList_TurnRow"].ToString()); Class_QuestionSelect class_questionSelect = new Class_QuestionSelect(); class_questionSelect.QuestionSelect_ID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_ID"].ToString()); class_questionSelect.QuestionSelect_MainID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_MainID"].ToString()); class_questionSelect.QuestionSelect_ListID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_ListID"].ToString()); class_questionSelect.QuestionSelect_Text = dt.Rows[i]["QuestionSelect_Text"].ToString(); class_questionSelect.QuestionSelect_Score = Convert.ToInt32(dt.Rows[i]["QuestionSelect_Score"].ToString()); ArrayList list_questionSelect = new ArrayList(); list_questionSelect.Add(class_questionSelect); list_QuestionList.Add(class_question); class_question.Class_QuestionSelect = list_questionSelect; QuestionList_Sequence = QuestionList_ID; j++; } else { Class_Question class_question = (Class_Question)list_QuestionList[j]; ArrayList list_question = class_question.Class_QuestionSelect; Class_QuestionSelect class_questionSelect = new Class_QuestionSelect(); class_questionSelect.QuestionSelect_ID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_ID"].ToString()); class_questionSelect.QuestionSelect_MainID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_MainID"].ToString()); class_questionSelect.QuestionSelect_ListID = Convert.ToInt32(dt.Rows[i]["QuestionSelect_ListID"].ToString()); class_questionSelect.QuestionSelect_Text = dt.Rows[i]["QuestionSelect_Text"].ToString(); class_questionSelect.QuestionSelect_Score = Convert.ToInt32(dt.Rows[i]["QuestionSelect_Score"].ToString()); list_question.Add(class_questionSelect); } } //显示每条题目 if (list_QuestionList.Count > 0) { QuestionList_Total = list_QuestionList.Count; QuestionList_TotalPage = (list_QuestionList.Count - 1) / 10 + 1; Panel panel = null; int p = QuestionList_CurrentPage; int i = 0; for (i = 0; i < list_QuestionList.Count; i++) { if (i % 10 == 0) { panel = new Panel(); panel.AutoSize = true; //panel.BorderStyle = BorderStyle.Fixed3D; panel.Location = new System.Drawing.Point(pictureBox1.Location.X, Panel_Height); panel.Name = "Panel_QuestionList" + p.ToString(); panel.Visible = false; panel.ControlAdded += new ControlEventHandler(Panel_Control_Added); Controls.Add(panel); if (p == QuestionList_CurrentPage) panel.Visible = true; p++; Controls_Height = 0; } Class_Question class_question = (Class_Question)list_QuestionList[i]; Control_QuestionList control_questionList = new Control_QuestionList(class_question, class_clientInfo); if (hash_answerList != null && hash_answerList.Count > 0) { ArrayList list_questionSelect = (ArrayList)hash_answerList[class_question.QuestionList_ID]; control_questionList.QuestionSelect_List = list_questionSelect; } control_questionList.Show_QuestionList(); panel.Controls.Add(control_questionList); } String Question_Tail = function_question.Query_Question_Tail(Question_ID); if (!String.IsNullOrEmpty(Question_Tail)) label7.Text = Question_Tail; else { label7.Visible = false; Text_Question_Tail.Visible = false; } if (panel != null) { panel.Controls.Add(label7); panel.Controls.Add(Text_Question_Tail); } Control[] panel_controls = Controls.Find("Panel_QuestionList" + QuestionList_CurrentPage, false); if (panel_controls == null || panel_controls.Length == 0) return; if (panel_controls[0] is Panel) { panel = (Panel)panel_controls[0]; choiButton1.Location = new Point(choiButton1.Location.X, panel.Location.Y + panel.Size.Height + 10); choiButton2.Location = new Point(choiButton2.Location.X, panel.Location.Y + panel.Size.Height + 10); choiButton3.Location = new Point(choiButton3.Location.X, panel.Location.Y + panel.Size.Height + 10); } } } } }
private void choiButton1_Click(object sender, EventArgs e) { FolderBrowserDialog folderBrowser = new FolderBrowserDialog(); folderBrowser.SelectedPath = Application.StartupPath; DialogResult Result = folderBrowser.ShowDialog(); if (Result == DialogResult.OK || Result == DialogResult.Yes) { if (QuestionTable == null || QuestionTable.Count <= 0) Set_QuestionTable(); if (listView1.SelectedItems.Count > 0 && QuestionTable != null && QuestionTable.Count > 0) { Class_Excel class_Excel = new Class_Excel(); Function_ClientInfo function_clientInfo = new Function_ClientInfo(); for (int i = 0; i < listView1.SelectedItems.Count;i++) { if (CommonFunction.IsNumber(listView1.SelectedItems[i].Text, 1)) { int ClientID = Convert.ToInt32(listView1.SelectedItems[i].Text); DataTable ClientInfo = function_clientInfo.Query_ClientInfo(ClientID); if (ClientInfo == null || ClientInfo.Rows.Count <= 0) continue; String ExcelFile = ClientInfo.Rows[0]["ClientInfo_Name"].ToString() + "-" + ClientInfo.Rows[0]["ClientInfo_ID"].ToString() + ".xls"; class_Excel.ExcelFile = folderBrowser.SelectedPath + "\\" + ExcelFile; Function_AnswerInfo function_answerInfo = new Function_AnswerInfo(); DataTable AnswerInfo = function_answerInfo.Query_AnswerInfo_List(ClientID); if (AnswerInfo != null && AnswerInfo.Rows.Count > 0) { int[] AnswerInfo_Array = new int[AnswerInfo.Rows.Count]; String Question_Tail = ""; for (int j = 0; j < AnswerInfo.Rows.Count; j++) { if (AnswerInfo.Rows[j]["Question_ID"] != null && CommonFunction.IsNumber(AnswerInfo.Rows[j]["Question_ID"].ToString(), 1)) { int QuestionID = Convert.ToInt32(AnswerInfo.Rows[j]["Question_ID"].ToString()); int AnswerInfo_ID = Convert.ToInt32(AnswerInfo.Rows[j]["AnswerInfo_ID"].ToString()); if (QuestionID == 1) Question_Tail = AnswerInfo.Rows[j]["Question_Tail"].ToString(); if (QuestionTable.ContainsKey(QuestionID)) { ArrayList QuestionArray = (ArrayList)QuestionTable[QuestionID]; Function_AnswerList function_answerList = new Function_AnswerList(); DataTable AnswerList = function_answerList.Query_AnswerList(AnswerInfo_ID); for (int k = 0; k < QuestionArray.Count; k++) { Class_AnswerTable class_answerTable = (Class_AnswerTable)QuestionArray[k]; if (AnswerList.Rows[k]["QuestionSelect_ID"] != null && CommonFunction.IsNumber(AnswerList.Rows[k]["QuestionSelect_ID"].ToString(), 1)) { int QuestionSelect_ID = Convert.ToInt32(AnswerList.Rows[k]["QuestionSelect_ID"].ToString()); class_answerTable.AnswerTable_SelectID = QuestionSelect_ID; } QuestionArray[k] = class_answerTable; } AnswerInfo_Array[j] = QuestionID; QuestionTable[QuestionID] = QuestionArray; } } } class_Excel.OutToFile(ClientInfo, QuestionTable, AnswerInfo_Array, AnswerInfo_Table, Question_Tail); } else { class_Excel.OutToFile(ClientInfo, null, null, null, ""); } } } class_Excel.ExcelClose(); class_Excel = null; MessageBox.Show("导出成功!"); } } }
private void listView_Refresh() { listView1.Items.Clear(); Function_ClientInfo function_clientInfo = new Function_ClientInfo(); Function_AnswerInfo function_answerInfo = new Function_AnswerInfo(); DataTable dt = function_clientInfo.Query_ClientInfo(); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { int ClientID = Convert.ToInt32(dt.Rows[i]["ClientInfo_ID"].ToString()); int AnswerInfo = function_answerInfo.Query_AnswerInfo_Client(ClientID); listView1.Items.Add(dt.Rows[i]["ClientInfo_ID"].ToString()); listView1.Items[i].SubItems.Add(dt.Rows[i]["ClientInfo_Name"].ToString()); if (dt.Rows[i]["ClientInfo_Age"] != null && !String.IsNullOrEmpty(dt.Rows[i]["ClientInfo_Age"].ToString())) listView1.Items[i].SubItems.Add(dt.Rows[i]["ClientInfo_Age"].ToString()); else listView1.Items[i].SubItems.Add(""); if (dt.Rows[i]["ClientInfo_Sex"] != null && !String.IsNullOrEmpty(dt.Rows[i]["ClientInfo_Sex"].ToString())) { if (dt.Rows[i]["ClientInfo_Sex"].ToString() == "1") listView1.Items[i].SubItems.Add("男"); else listView1.Items[i].SubItems.Add("女"); } else listView1.Items[i].SubItems.Add(""); listView1.Items[i].SubItems.Add(AnswerInfo.ToString()); } if (listView1.Items.Count > 0) { listView1.Items[0].Selected = true; } } }