DB Connection 수정 중

This commit is contained in:
jhlee
2021-03-21 19:31:31 +09:00
parent 945c9a3bbd
commit 196dd06f23
4 changed files with 139 additions and 60 deletions

View File

@@ -36,9 +36,11 @@
this.label_ExchangePlace = new System.Windows.Forms.Label();
this.comboBoxEdit_ExchangePlace = new DevExpress.XtraEditors.ComboBoxEdit();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button1 = new System.Windows.Forms.Button();
this.textEdit_DbServerIp = new DevExpress.XtraEditors.TextEdit();
this.label_DbServerIp = new System.Windows.Forms.Label();
this.label_QueryStr = new System.Windows.Forms.Label();
this.textEdit_SqLQuery = new DevExpress.XtraEditors.TextEdit();
this.button_QueryTest = new System.Windows.Forms.Button();
this.button_TotalDataSave = new System.Windows.Forms.Button();
this.button_ExchangePlaceSave = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
this.panelControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.listBoxControl_logViewer)).BeginInit();
@@ -47,7 +49,7 @@
this.groupBox_ButtonMenu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.textEdit_DbServerIp.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.textEdit_SqLQuery.Properties)).BeginInit();
this.SuspendLayout();
//
// panelControl1
@@ -81,17 +83,19 @@
//
this.groupBox_ButtonMenu.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox_ButtonMenu.Controls.Add(this.button_ExchangePlaceSave);
this.groupBox_ButtonMenu.Controls.Add(this.button_TotalDataSave);
this.groupBox_ButtonMenu.Controls.Add(this.button_CreateTable);
this.groupBox_ButtonMenu.Location = new System.Drawing.Point(5, 64);
this.groupBox_ButtonMenu.Location = new System.Drawing.Point(5, 97);
this.groupBox_ButtonMenu.Name = "groupBox_ButtonMenu";
this.groupBox_ButtonMenu.Size = new System.Drawing.Size(679, 95);
this.groupBox_ButtonMenu.Size = new System.Drawing.Size(679, 96);
this.groupBox_ButtonMenu.TabIndex = 0;
this.groupBox_ButtonMenu.TabStop = false;
this.groupBox_ButtonMenu.Text = "메뉴";
//
// button_CreateTable
//
this.button_CreateTable.Location = new System.Drawing.Point(6, 21);
this.button_CreateTable.Location = new System.Drawing.Point(102, 21);
this.button_CreateTable.Name = "button_CreateTable";
this.button_CreateTable.Size = new System.Drawing.Size(75, 23);
this.button_CreateTable.TabIndex = 0;
@@ -122,40 +126,60 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.label_ExchangePlace);
this.groupBox1.Controls.Add(this.comboBoxEdit_ExchangePlace);
this.groupBox1.Controls.Add(this.label_DbServerIp);
this.groupBox1.Controls.Add(this.textEdit_DbServerIp);
this.groupBox1.Controls.Add(this.button1);
this.groupBox1.Controls.Add(this.label_QueryStr);
this.groupBox1.Controls.Add(this.textEdit_SqLQuery);
this.groupBox1.Controls.Add(this.button_QueryTest);
this.groupBox1.Location = new System.Drawing.Point(5, 5);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(679, 53);
this.groupBox1.Size = new System.Drawing.Size(679, 73);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "DB 접속";
//
// button1
// label_QueryStr
//
this.button1.Location = new System.Drawing.Point(382, 20);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "연결";
this.button1.UseVisualStyleBackColor = true;
this.label_QueryStr.AutoSize = true;
this.label_QueryStr.Location = new System.Drawing.Point(17, 50);
this.label_QueryStr.Name = "label_QueryStr";
this.label_QueryStr.Size = new System.Drawing.Size(39, 14);
this.label_QueryStr.TabIndex = 4;
this.label_QueryStr.Text = "쿼리 : ";
//
// textEdit_DbServerIp
// textEdit_SqLQuery
//
this.textEdit_DbServerIp.Location = new System.Drawing.Point(244, 21);
this.textEdit_DbServerIp.Name = "textEdit_DbServerIp";
this.textEdit_DbServerIp.Size = new System.Drawing.Size(121, 20);
this.textEdit_DbServerIp.TabIndex = 1;
this.textEdit_SqLQuery.Location = new System.Drawing.Point(62, 47);
this.textEdit_SqLQuery.Name = "textEdit_SqLQuery";
this.textEdit_SqLQuery.Size = new System.Drawing.Size(537, 20);
this.textEdit_SqLQuery.TabIndex = 1;
//
// label_DbServerIp
// button_QueryTest
//
this.label_DbServerIp.AutoSize = true;
this.label_DbServerIp.Location = new System.Drawing.Point(175, 24);
this.label_DbServerIp.Name = "label_DbServerIp";
this.label_DbServerIp.Size = new System.Drawing.Size(63, 14);
this.label_DbServerIp.TabIndex = 4;
this.label_DbServerIp.Text = "서버 주소 : ";
this.button_QueryTest.Location = new System.Drawing.Point(605, 46);
this.button_QueryTest.Name = "button_QueryTest";
this.button_QueryTest.Size = new System.Drawing.Size(68, 23);
this.button_QueryTest.TabIndex = 0;
this.button_QueryTest.Text = "보내기";
this.button_QueryTest.UseVisualStyleBackColor = true;
this.button_QueryTest.Click += new System.EventHandler(this.button_QueryTest_Click);
//
// button_TotalDataSave
//
this.button_TotalDataSave.Location = new System.Drawing.Point(7, 50);
this.button_TotalDataSave.Name = "button_TotalDataSave";
this.button_TotalDataSave.Size = new System.Drawing.Size(108, 23);
this.button_TotalDataSave.TabIndex = 0;
this.button_TotalDataSave.Text = "전 종목 데이터 누적";
this.button_TotalDataSave.UseVisualStyleBackColor = true;
//
// button_ExchangePlaceSave
//
this.button_ExchangePlaceSave.Location = new System.Drawing.Point(10, 21);
this.button_ExchangePlaceSave.Name = "button_ExchangePlaceSave";
this.button_ExchangePlaceSave.Size = new System.Drawing.Size(86, 23);
this.button_ExchangePlaceSave.TabIndex = 0;
this.button_ExchangePlaceSave.Text = "종목 업데이트";
this.button_ExchangePlaceSave.UseVisualStyleBackColor = true;
this.button_ExchangePlaceSave.Click += new System.EventHandler(this.button_ExchangePlaceSave_Click);
//
// MainForm
//
@@ -175,7 +199,7 @@
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).EndInit();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.textEdit_DbServerIp.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.textEdit_SqLQuery.Properties)).EndInit();
this.ResumeLayout(false);
}
@@ -190,9 +214,11 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label_ExchangePlace;
private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit_ExchangePlace;
private System.Windows.Forms.Label label_DbServerIp;
private DevExpress.XtraEditors.TextEdit textEdit_DbServerIp;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label_QueryStr;
private DevExpress.XtraEditors.TextEdit textEdit_SqLQuery;
private System.Windows.Forms.Button button_QueryTest;
private System.Windows.Forms.Button button_TotalDataSave;
private System.Windows.Forms.Button button_ExchangePlaceSave;
}
}

View File

@@ -19,31 +19,40 @@ namespace DataSaver
initForm();
}
/// <summary>
/// 초기 동작
/// </summary>
private void initForm()
{
// DB 서버 정보 생성
var strConn = "Data Source=192.168.0.21;uid=sqlm;pwd=12345678;Database=Upbit";
// DB Connection 생성하기
// 거래소 정보 콤보박스 초기화
comboBoxEdit_ExchangePlace.Properties.Items.Clear();
// Million으로부터 거래소 정보 가져오기
comboBoxEdit_ExchangePlace.Properties.Items.AddRange(Enum.GetNames(typeof(Million.CommonProperty.ExchangePlace)));
comboBoxEdit_ExchangePlace.SelectedIndex = 0;
// DB 서버 정보 생성
var strConn = Million.CommonProperty.DbConnectionStr + comboBoxEdit_ExchangePlace.EditValue;
Million.CommonProperty.curDBConStrDataSaver = strConn;
}
private void comboBoxEdit1_SelectedIndexChanged(object sender, EventArgs e)
/// <summary>
/// 쿼리 테스트 버튼 클릭
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button_QueryTest_Click(object sender, EventArgs e)
{
// Table 없으면 추가
/*
if not exists(select * from sysobjects where name = 'krw_btc' and xtype = 'U')
create table krw_btc(
Name varchar(64) not null
)
go*/
Million.FileDBManagement.DBConnection.DataBasaConnection(Million.CommonProperty.curDBConStrDataSaver, textEdit_SqLQuery.Text);
}
/// <summary>
/// 종목 업데이트 버튼 클릭
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button_ExchangePlaceSave_Click(object sender, EventArgs e)
{
//illion.
}
}
}