📄 yonghuziliaoxiugai.h
字号:
this->label1->TabIndex = 38;
this->label1->Text = S"ID:";
this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
//
// oleDbDeleteCommand1
//
this->oleDbDeleteCommand1->CommandText = S"DELETE FROM 消费表 WHERE (SID = \?)";
this->oleDbDeleteCommand1->Connection = this->oleDbConnection1;
this->oleDbDeleteCommand1->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"Original_SID", System::Data::OleDb::OleDbType::VarChar, 10, System::Data::ParameterDirection::Input, false, (System::Byte)0, (System::Byte)0, S"SID", System::Data::DataRowVersion::Original, 0));
//
// oleDbSelectCommand1
//
this->oleDbSelectCommand1->CommandText = S"SELECT SID, SNAME, SMODEL, SPRODUCER, SSELLPRICE, SSTOCKPRICE, SQUANTITY, SWNAME,"
S" SDATE, YID FROM 消费表";
this->oleDbSelectCommand1->Connection = this->oleDbConnection1;
//
// oleDbDataAdapter1
//
this->oleDbDataAdapter1->DeleteCommand = this->oleDbDeleteCommand1;
this->oleDbDataAdapter1->InsertCommand = this->oleDbInsertCommand1;
this->oleDbDataAdapter1->SelectCommand = this->oleDbSelectCommand1;
System::Data::Common::DataTableMapping* __mcTemp__2[] = new System::Data::Common::DataTableMapping*[1];
System::Data::Common::DataColumnMapping* __mcTemp__3[] = new System::Data::Common::DataColumnMapping*[10];
__mcTemp__3[0] = new System::Data::Common::DataColumnMapping(S"SID", S"SID");
__mcTemp__3[1] = new System::Data::Common::DataColumnMapping(S"SNAME", S"SNAME");
__mcTemp__3[2] = new System::Data::Common::DataColumnMapping(S"SMODEL", S"SMODEL");
__mcTemp__3[3] = new System::Data::Common::DataColumnMapping(S"SPRODUCER", S"SPRODUCER");
__mcTemp__3[4] = new System::Data::Common::DataColumnMapping(S"SSELLPRICE", S"SSELLPRICE");
__mcTemp__3[5] = new System::Data::Common::DataColumnMapping(S"SSTOCKPRICE", S"SSTOCKPRICE");
__mcTemp__3[6] = new System::Data::Common::DataColumnMapping(S"SQUANTITY", S"SQUANTITY");
__mcTemp__3[7] = new System::Data::Common::DataColumnMapping(S"SWNAME", S"SWNAME");
__mcTemp__3[8] = new System::Data::Common::DataColumnMapping(S"SDATE", S"SDATE");
__mcTemp__3[9] = new System::Data::Common::DataColumnMapping(S"YID", S"YID");
__mcTemp__2[0] = new System::Data::Common::DataTableMapping(S"Table", S"消费表", __mcTemp__3);
this->oleDbDataAdapter1->TableMappings->AddRange(__mcTemp__2);
this->oleDbDataAdapter1->UpdateCommand = this->oleDbUpdateCommand1;
//
// comboBox3
//
System::Object* __mcTemp__4[] = new System::Object*[99];
__mcTemp__4[0] = S"1";
__mcTemp__4[1] = S"2";
__mcTemp__4[2] = S"3";
__mcTemp__4[3] = S"4";
__mcTemp__4[4] = S"5";
__mcTemp__4[5] = S"6";
__mcTemp__4[6] = S"7";
__mcTemp__4[7] = S"8";
__mcTemp__4[8] = S"9";
__mcTemp__4[9] = S"10";
__mcTemp__4[10] = S"11";
__mcTemp__4[11] = S"12";
__mcTemp__4[12] = S"13";
__mcTemp__4[13] = S"14";
__mcTemp__4[14] = S"15";
__mcTemp__4[15] = S"16";
__mcTemp__4[16] = S"17";
__mcTemp__4[17] = S"18";
__mcTemp__4[18] = S"19";
__mcTemp__4[19] = S"20";
__mcTemp__4[20] = S"21";
__mcTemp__4[21] = S"22";
__mcTemp__4[22] = S"23";
__mcTemp__4[23] = S"24";
__mcTemp__4[24] = S"25";
__mcTemp__4[25] = S"26";
__mcTemp__4[26] = S"27";
__mcTemp__4[27] = S"28";
__mcTemp__4[28] = S"29";
__mcTemp__4[29] = S"30";
__mcTemp__4[30] = S"31";
__mcTemp__4[31] = S"32";
__mcTemp__4[32] = S"33";
__mcTemp__4[33] = S"34";
__mcTemp__4[34] = S"35";
__mcTemp__4[35] = S"36";
__mcTemp__4[36] = S"37";
__mcTemp__4[37] = S"38";
__mcTemp__4[38] = S"39";
__mcTemp__4[39] = S"40";
__mcTemp__4[40] = S"41";
__mcTemp__4[41] = S"42";
__mcTemp__4[42] = S"43";
__mcTemp__4[43] = S"44";
__mcTemp__4[44] = S"45";
__mcTemp__4[45] = S"46";
__mcTemp__4[46] = S"47";
__mcTemp__4[47] = S"48";
__mcTemp__4[48] = S"49";
__mcTemp__4[49] = S"50";
__mcTemp__4[50] = S"51";
__mcTemp__4[51] = S"52";
__mcTemp__4[52] = S"53";
__mcTemp__4[53] = S"54";
__mcTemp__4[54] = S"55";
__mcTemp__4[55] = S"56";
__mcTemp__4[56] = S"57";
__mcTemp__4[57] = S"58";
__mcTemp__4[58] = S"59";
__mcTemp__4[59] = S"60";
__mcTemp__4[60] = S"61";
__mcTemp__4[61] = S"62";
__mcTemp__4[62] = S"63";
__mcTemp__4[63] = S"64";
__mcTemp__4[64] = S"65";
__mcTemp__4[65] = S"66";
__mcTemp__4[66] = S"67";
__mcTemp__4[67] = S"68";
__mcTemp__4[68] = S"69";
__mcTemp__4[69] = S"70";
__mcTemp__4[70] = S"71";
__mcTemp__4[71] = S"72";
__mcTemp__4[72] = S"73";
__mcTemp__4[73] = S"74";
__mcTemp__4[74] = S"75";
__mcTemp__4[75] = S"76";
__mcTemp__4[76] = S"77";
__mcTemp__4[77] = S"78";
__mcTemp__4[78] = S"79";
__mcTemp__4[79] = S"80";
__mcTemp__4[80] = S"81";
__mcTemp__4[81] = S"82";
__mcTemp__4[82] = S"83";
__mcTemp__4[83] = S"84";
__mcTemp__4[84] = S"85";
__mcTemp__4[85] = S"86";
__mcTemp__4[86] = S"87";
__mcTemp__4[87] = S"88";
__mcTemp__4[88] = S"89";
__mcTemp__4[89] = S"90";
__mcTemp__4[90] = S"91";
__mcTemp__4[91] = S"92";
__mcTemp__4[92] = S"93";
__mcTemp__4[93] = S"94";
__mcTemp__4[94] = S"95";
__mcTemp__4[95] = S"96";
__mcTemp__4[96] = S"97";
__mcTemp__4[97] = S"98";
__mcTemp__4[98] = S"99";
this->comboBox3->Items->AddRange(__mcTemp__4);
this->comboBox3->Location = System::Drawing::Point(336, 64);
this->comboBox3->Name = S"comboBox3";
this->comboBox3->Size = System::Drawing::Size(144, 20);
this->comboBox3->TabIndex = 59;
//
// comboBox2
//
System::Object* __mcTemp__5[] = new System::Object*[2];
__mcTemp__5[0] = S"男";
__mcTemp__5[1] = S"女";
this->comboBox2->Items->AddRange(__mcTemp__5);
this->comboBox2->Location = System::Drawing::Point(104, 96);
this->comboBox2->Name = S"comboBox2";
this->comboBox2->Size = System::Drawing::Size(144, 20);
this->comboBox2->TabIndex = 60;
//
// yonghuziliaoxiugai
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->ClientSize = System::Drawing::Size(608, 446);
this->Controls->Add(this->comboBox2);
this->Controls->Add(this->comboBox3);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->textBox6);
this->Controls->Add(this->label7);
this->Controls->Add(this->textBox5);
this->Controls->Add(this->label6);
this->Controls->Add(this->comboBox1);
this->Controls->Add(this->label5);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->label2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label1);
this->Controls->Add(this->button1);
this->Controls->Add(this->dataGrid1);
this->Name = S"yonghuziliaoxiugai";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = S"用户资料修改";
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dataGrid1))->EndInit();
this->ResumeLayout(false);
}
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{String *NID=this->textBox1->Text->Trim();
oleDbSelectCommand1->CommandText=String::Concat(S"select NID as 用户ID,NAME as 姓名,AGE as 年龄,SEX as 性别,COMPANY as 部门,STATUS as 身份,ADDS as 地址 from 用户表 where ",S"NID='",NID,S"'" );
oleDbConnection1->Open();
oleDbSelectCommand1->ExecuteNonQuery();
oleDbConnection1->Close();
DataTable *table1=new DataTable();
oleDbDataAdapter1->Fill(table1);
this->dataGrid1->DataSource=table1;
}
private: System::Void button2_Click(System::Object * sender, System::EventArgs * e)
{ String *NID=this->textBox1->Text->Trim();
oleDbSelectCommand1->CommandText=String::Concat(S"select NID as 用户ID,NAME as 姓名,AGE as 年龄,SEX as 性别,COMPANY as 部门,STATUS as 身份,ADDS as 地址 from 用户表 where ",S"NID='",NID,S"'" );
oleDbConnection1->Open();
oleDbSelectCommand1->ExecuteNonQuery();
oleDbConnection1->Close();
DataTable *table2=new DataTable();
oleDbDataAdapter1->Fill(table2);
this->dataGrid1->DataSource=table2;
int nindex=dataGrid1->CurrentRowIndex;
DataTable *table3=__try_cast<DataTable*>(dataGrid1->DataSource);
if(nindex<0) MessageBox::Show("用户ID错误");
else{ int i=0;
if(this->textBox2->Text->CompareTo("")==0) {MessageBox::Show("姓名不能为空");
i++; }
if(this->textBox2->Text->Length>20) {MessageBox::Show("姓名太长");
i++;}
if(this->comboBox3->Text->CompareTo("")==0) {MessageBox::Show("年龄不能为空");
i++;}
if(this->comboBox3->Text->Length>4) {MessageBox::Show("年龄太长");
i++; }
if(this->comboBox2->Text->CompareTo("")==0) {MessageBox::Show("性别不能为空");
i++;}
if(this->comboBox2->Text->Length>4){ MessageBox::Show("性别太长");
i++;}
if(this->comboBox1->Text->CompareTo("")==0) {MessageBox::Show("部门不能为空");
i++;}
if(this->comboBox1->Text->Length>20){ MessageBox::Show("部门太长");
i++;}
if(this->textBox5->Text->CompareTo("")==0) {MessageBox::Show("身份证不能为空");
i++;}
if(this->textBox5->Text->Length>20) {MessageBox::Show("身份证太长");
i++;}
if(this->textBox6->Text->CompareTo("")==0) {MessageBox::Show("地址不能为空");
i++;}
if(this->textBox6->Text->Length>50){ MessageBox::Show("地址太长");
i++;}
if(i==0){
String *NAME=this->textBox2->Text->Trim();
String *AGE=this->comboBox3->Text->Trim();
String *SEX=this->comboBox2->Text->Trim();
String *COMPANY=this->comboBox1->Text->Trim();
String *STATUS=this->textBox5->Text->Trim();
String *ADDS=this->textBox6->Text->Trim();
oleDbInsertCommand1->CommandText=String::Concat(S"update 用户表 set ",S"NAME='",NAME,S"',",S"AGE='",AGE,S"',",S"SEX='",SEX,S"',",S"COMPANY='",COMPANY,S"',",S"STATUS='",STATUS,S"',",S"ADDS='",ADDS,S"'",S" where NID='",NID,S"'" );
oleDbConnection1->Open();
oleDbInsertCommand1->ExecuteNonQuery();
oleDbConnection1->Close();
DataTable *table1=new DataTable();
oleDbDataAdapter1->Fill(table1);
this->dataGrid1->DataSource=table1;
}
}
}
private: System::Void button3_Click(System::Object * sender, System::EventArgs * e)
{this->textBox1->Text="";
this->textBox2->Text="";
this->comboBox3->Text="";
this->comboBox2->Text="";
this->comboBox1->Text="";
this->textBox5->Text="";
this->textBox6->Text="";
}
private: System::Void dataGrid1_CurrentCellChanged(System::Object * sender, System::EventArgs * e)
{int nindex=dataGrid1->CurrentRowIndex;
if(nindex<0)
{this->textBox1->Text=S"";
this->textBox2->Text=S"";
this->comboBox3->Text=S"";
this->comboBox2->Text=S"";
this->comboBox1->Text=S"";
this->textBox5->Text=S"";
this->textBox6->Text=S"";
return;
}
DataTable *table2=__try_cast<DataTable*>(dataGrid1->DataSource);
DataRow * row=table2->Rows->Item[nindex];
this->textBox1->Text=row->Item[0]->ToString();
this->textBox2->Text=row->Item[1]->ToString();
this->comboBox3->Text=row->Item[2]->ToString();
this->comboBox2->Text=row->Item[3]->ToString();
this->comboBox1->Text=row->Item[4]->ToString();
this->textBox5->Text=row->Item[5]->ToString();
this->textBox6->Text=row->Item[6]->ToString();
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -