質問編集履歴
2
2
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,8 +50,8 @@
|
|
50
50
|
if (txtSiteNm.Text == "")
|
51
51
|
{
|
52
52
|
using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3"))
|
53
|
-
//using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/Takaaki Kawabe/Desktop/WindowsFormsApplication4 /myfriend.sqlite3"))
|
54
53
|
|
54
|
+
|
55
55
|
using (SQLiteDataAdapter adapter = new SQLiteDataAdapter("select * from PASS_KANRI", con))
|
56
56
|
{
|
57
57
|
//データグリッドビューのクリア
|
1
あ
title
CHANGED
File without changes
|
body
CHANGED
@@ -49,14 +49,14 @@
|
|
49
49
|
//検索条件がない場合
|
50
50
|
if (txtSiteNm.Text == "")
|
51
51
|
{
|
52
|
-
using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/Desktop/WindowsFormsApplication4/myfriend.sqlite3"))
|
52
|
+
using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3"))
|
53
|
+
//using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/Takaaki Kawabe/Desktop/WindowsFormsApplication4 /myfriend.sqlite3"))
|
53
54
|
|
54
55
|
using (SQLiteDataAdapter adapter = new SQLiteDataAdapter("select * from PASS_KANRI", con))
|
55
56
|
{
|
56
57
|
//データグリッドビューのクリア
|
57
58
|
datatable.Clear();
|
58
59
|
|
59
|
-
var Datatable = new DataTable();
|
60
60
|
dataGridView1.DataSource = datatable;
|
61
61
|
adapter.Fill(datatable);
|
62
62
|
|
@@ -74,38 +74,71 @@
|
|
74
74
|
}
|
75
75
|
else
|
76
76
|
{
|
77
|
-
string dbConnectionString = "Data Source = C:\\Users/Desktop/WindowsFormsApplication4/myfriend.sqlite3";
|
77
|
+
string dbConnectionString = "Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3";
|
78
78
|
using (SQLiteConnection cn = new SQLiteConnection(dbConnectionString))
|
79
79
|
{
|
80
80
|
cn.Open();
|
81
81
|
using (SQLiteTransaction trans = cn.BeginTransaction())
|
82
82
|
{
|
83
83
|
SQLiteCommand cmd = cn.CreateCommand();
|
84
|
-
//
|
84
|
+
//DBセレクト
|
85
85
|
cmd.CommandText = "SELECT * from PASS_KANRI where SiteNm = @SiteNm";
|
86
86
|
|
87
|
-
//パラメータ
|
87
|
+
//パラメータセット
|
88
88
|
cmd.Parameters.Add("SiteNm", System.Data.DbType.String);
|
89
89
|
|
90
90
|
cmd.Parameters["SiteNm"].Value = txtSiteNm.Text;
|
91
91
|
|
92
|
-
//
|
92
|
+
//datatableのクリア
|
93
93
|
datatable.Clear();
|
94
|
+
//datatableに検索結果をセット
|
95
|
+
datatable.Load(cmd.ExecuteReader());
|
94
96
|
|
95
|
-
var Datatable = new DataTable();
|
96
97
|
dataGridView1.DataSource = datatable;
|
97
98
|
|
99
|
+
//dataGridView1.Columns[0].HeaderText = "ID";
|
100
|
+
//No,SiteNm,LoginId,Password,BIKO カラム順
|
101
|
+
//テーブルの内容表示
|
98
102
|
dataGridView1.Columns[0].HeaderText = "No";
|
99
103
|
dataGridView1.Columns[1].HeaderText = "サイト名";
|
100
104
|
dataGridView1.Columns[2].HeaderText = "ログインIDまたはEmail等";
|
101
105
|
dataGridView1.Columns[3].HeaderText = "パスワード";
|
102
106
|
dataGridView1.Columns[4].HeaderText = "登録日";
|
103
107
|
dataGridView1.Columns[5].HeaderText = "備考";
|
108
|
+
trans.Commit();
|
109
|
+
cn.Close();
|
104
110
|
|
105
|
-
cmd.ExecuteNonQuery();
|
106
|
-
|
107
111
|
}
|
108
112
|
}
|
113
|
+
//string dbConnectionString = "Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3";
|
114
|
+
////string dbConnectionString = "Data Source = C:\\Users/Takaaki Kawabe/Desktop/WindowsFormsApplication4 /myfriend.sqlite3";
|
115
|
+
//using (SQLiteConnection cn = new SQLiteConnection(dbConnectionString))
|
116
|
+
//{
|
117
|
+
// cn.Open();
|
118
|
+
// using (SQLiteTransaction trans = cn.BeginTransaction())
|
119
|
+
// {
|
120
|
+
// SQLiteCommand cmd = cn.CreateCommand();
|
121
|
+
// //select文を走らせる
|
122
|
+
// cmd.CommandText = "SELECT * from PASS_KANRI where SiteNm = @SiteNm";
|
123
|
+
|
124
|
+
// //パラメータのセット
|
125
|
+
// cmd.Parameters.Add("SiteNm", System.Data.DbType.String);
|
126
|
+
|
127
|
+
// cmd.Parameters["SiteNm"].Value = txtSiteNm.Text;
|
128
|
+
|
129
|
+
// //データグリッドビューのクリア
|
130
|
+
// datatable.Clear();
|
131
|
+
|
132
|
+
// var Datatable = new DataTable();
|
133
|
+
// dataGridView1.DataSource = datatable;
|
134
|
+
|
135
|
+
// dataGridView1.Columns[0].HeaderText = "No";
|
136
|
+
// dataGridView1.Columns[1].HeaderText = "サイト名";
|
137
|
+
// dataGridView1.Columns[2].HeaderText = "ログインIDまたはEmail等";
|
138
|
+
// dataGridView1.Columns[3].HeaderText = "パスワード";
|
139
|
+
// dataGridView1.Columns[4].HeaderText = "登録日";
|
140
|
+
// dataGridView1.Columns[5].HeaderText = "備考";
|
141
|
+
|
109
142
|
}
|
110
143
|
}
|
111
144
|
/// <summary>
|
@@ -125,9 +158,32 @@
|
|
125
158
|
|
126
159
|
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
|
127
160
|
{
|
161
|
+
//DataGridViewの内容をコピー
|
128
|
-
|
162
|
+
Clipboard.SetDataObject(dataGridView1.GetClipboardContent());
|
129
163
|
}
|
164
|
+
|
165
|
+
private void Itiran_Load(object sender, EventArgs e)
|
166
|
+
{
|
167
|
+
|
168
|
+
}
|
169
|
+
|
170
|
+
private void Itiran_KeyDown(object sender, KeyEventArgs e)
|
171
|
+
{
|
172
|
+
//Enterキーでコントロール遷移
|
173
|
+
if (e.KeyCode == Keys.Enter)
|
174
|
+
{
|
175
|
+
if (e.Shift)
|
176
|
+
{
|
177
|
+
ProcessTabKey(false);
|
178
|
+
}
|
179
|
+
else
|
180
|
+
{
|
181
|
+
ProcessTabKey(true);
|
182
|
+
}
|
183
|
+
}
|
184
|
+
}
|
130
185
|
}
|
131
186
|
}
|
132
187
|
|
188
|
+
|
133
189
|
```
|