📄 form1.h
字号:
#pragma once
namespace ADONET
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <summary>
/// Form1 摘要
///
/// 警告: 如果您更改该类的名称,则需要更改
/// 与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。 否则,
/// 设计器将不能与此窗体关联的
/// 本地化资源正确交互。
/// </summary>
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Data::OleDb::OleDbDataAdapter * oleDbDataAdapter1;
private: System::Data::OleDb::OleDbCommand * oleDbSelectCommand1;
private: System::Data::OleDb::OleDbConnection * oleDbConnection1;
private: ADONET::DataSet1 * dataSet11;
private: System::Windows::Forms::DataGrid * dataGrid1;
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container * components;
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->oleDbDataAdapter1 = new System::Data::OleDb::OleDbDataAdapter();
this->oleDbSelectCommand1 = new System::Data::OleDb::OleDbCommand();
this->oleDbConnection1 = new System::Data::OleDb::OleDbConnection();
this->dataSet11 = new ADONET::DataSet1();
this->dataGrid1 = new System::Windows::Forms::DataGrid();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dataSet11))->BeginInit();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dataGrid1))->BeginInit();
this->SuspendLayout();
//
// oleDbDataAdapter1
//
this->oleDbDataAdapter1->SelectCommand = this->oleDbSelectCommand1;
System::Data::Common::DataTableMapping* __mcTemp__1[] = new System::Data::Common::DataTableMapping*[1];
System::Data::Common::DataColumnMapping* __mcTemp__2[] = new System::Data::Common::DataColumnMapping*[4];
__mcTemp__2[0] = new System::Data::Common::DataColumnMapping(S"Name", S"Name");
__mcTemp__2[1] = new System::Data::Common::DataColumnMapping(S"Math", S"Math");
__mcTemp__2[2] = new System::Data::Common::DataColumnMapping(S"Literary", S"Literary");
__mcTemp__2[3] = new System::Data::Common::DataColumnMapping(S"Total", S"Total");
__mcTemp__1[0] = new System::Data::Common::DataTableMapping(S"Table", S"grade", __mcTemp__2);
this->oleDbDataAdapter1->TableMappings->AddRange(__mcTemp__1);
//
// oleDbSelectCommand1
//
this->oleDbSelectCommand1->CommandText = S"SELECT Name, Math, Literary, Total FROM grade";
this->oleDbSelectCommand1->Connection = this->oleDbConnection1;
//
// oleDbConnection1
//
this->oleDbConnection1->ConnectionString = S"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database L"
S"ocking Mode=1;Data Source=\ testdb.mdb\;Jet OLEDB:Engine Type=5;Provider=\""
S"Microsoft.Jet.OLEDB.4.0\";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist "
S"security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt "
S"Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don\'t Copy Local"
S"e on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;"
S"Jet OLEDB:Global Bulk Transactions=1";
//
// dataSet11
//
this->dataSet11->DataSetName = S"DataSet1";
this->dataSet11->Locale = new System::Globalization::CultureInfo(S"zh-CN");
//
// dataGrid1
//
this->dataGrid1->AlternatingBackColor = System::Drawing::Color::GhostWhite;
this->dataGrid1->BackColor = System::Drawing::Color::GhostWhite;
this->dataGrid1->BackgroundColor = System::Drawing::Color::Lavender;
this->dataGrid1->BorderStyle = System::Windows::Forms::BorderStyle::None;
this->dataGrid1->CaptionBackColor = System::Drawing::Color::RoyalBlue;
this->dataGrid1->CaptionForeColor = System::Drawing::Color::White;
this->dataGrid1->DataMember = S"";
this->dataGrid1->DataSource = this->dataSet11->grade;
this->dataGrid1->FlatMode = true;
this->dataGrid1->Font = new System::Drawing::Font(S"Tahoma", 8);
this->dataGrid1->ForeColor = System::Drawing::Color::MidnightBlue;
this->dataGrid1->GridLineColor = System::Drawing::Color::RoyalBlue;
this->dataGrid1->HeaderBackColor = System::Drawing::Color::MidnightBlue;
this->dataGrid1->HeaderFont = new System::Drawing::Font(S"Tahoma", 8, System::Drawing::FontStyle::Bold);
this->dataGrid1->HeaderForeColor = System::Drawing::Color::Lavender;
this->dataGrid1->LinkColor = System::Drawing::Color::Teal;
this->dataGrid1->Location = System::Drawing::Point(16, 16);
this->dataGrid1->Name = S"dataGrid1";
this->dataGrid1->ParentRowsBackColor = System::Drawing::Color::Lavender;
this->dataGrid1->ParentRowsForeColor = System::Drawing::Color::MidnightBlue;
this->dataGrid1->SelectionBackColor = System::Drawing::Color::Teal;
this->dataGrid1->SelectionForeColor = System::Drawing::Color::PaleGreen;
this->dataGrid1->Size = System::Drawing::Size(344, 184);
this->dataGrid1->TabIndex = 0;
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->ClientSize = System::Drawing::Size(376, 222);
this->Controls->Add(this->dataGrid1);
this->Name = S"Form1";
this->Text = S"访问数据库";
this->Load += new System::EventHandler(this, Form1_Load);
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dataSet11))->EndInit();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dataGrid1))->EndInit();
this->ResumeLayout(false);
}
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
oleDbDataAdapter1->Fill (dataSet11);
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -