質問編集履歴

2

2

2017/02/16 13:35

投稿

yamaguti
yamaguti

スコア185

test CHANGED
File without changes
test CHANGED
@@ -102,7 +102,7 @@
102
102
 
103
103
  using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3"))
104
104
 
105
- //using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/Takaaki Kawabe/Desktop/WindowsFormsApplication4 /myfriend.sqlite3"))
105
+
106
106
 
107
107
 
108
108
 

1

2017/02/16 13:35

投稿

yamaguti
yamaguti

スコア185

test CHANGED
File without changes
test CHANGED
@@ -100,7 +100,9 @@
100
100
 
101
101
  {
102
102
 
103
- using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/Desktop/WindowsFormsApplication4/myfriend.sqlite3"))
103
+ using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3"))
104
+
105
+ //using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/Takaaki Kawabe/Desktop/WindowsFormsApplication4 /myfriend.sqlite3"))
104
106
 
105
107
 
106
108
 
@@ -114,8 +116,6 @@
114
116
 
115
117
 
116
118
 
117
- var Datatable = new DataTable();
118
-
119
119
  dataGridView1.DataSource = datatable;
120
120
 
121
121
  adapter.Fill(datatable);
@@ -150,7 +150,7 @@
150
150
 
151
151
  {
152
152
 
153
- string dbConnectionString = "Data Source = C:\\Users/Desktop/WindowsFormsApplication4/myfriend.sqlite3";
153
+ string dbConnectionString = "Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3";
154
154
 
155
155
  using (SQLiteConnection cn = new SQLiteConnection(dbConnectionString))
156
156
 
@@ -164,13 +164,13 @@
164
164
 
165
165
  SQLiteCommand cmd = cn.CreateCommand();
166
166
 
167
- //select文を走らせる
167
+ //DBセレクト
168
168
 
169
169
  cmd.CommandText = "SELECT * from PASS_KANRI where SiteNm = @SiteNm";
170
170
 
171
171
 
172
172
 
173
- //パラメータセット
173
+ //パラメータセット
174
174
 
175
175
  cmd.Parameters.Add("SiteNm", System.Data.DbType.String);
176
176
 
@@ -180,18 +180,26 @@
180
180
 
181
181
 
182
182
 
183
- //データグリッドビューのクリア
183
+ //datatableのクリア
184
184
 
185
185
  datatable.Clear();
186
186
 
187
-
187
+ //datatableに検索結果をセット
188
-
188
+
189
- var Datatable = new DataTable();
189
+ datatable.Load(cmd.ExecuteReader());
190
+
191
+
190
192
 
191
193
  dataGridView1.DataSource = datatable;
192
194
 
193
195
 
194
196
 
197
+ //dataGridView1.Columns[0].HeaderText = "ID";
198
+
199
+ //No,SiteNm,LoginId,Password,BIKO カラム順
200
+
201
+ //テーブルの内容表示
202
+
195
203
  dataGridView1.Columns[0].HeaderText = "No";
196
204
 
197
205
  dataGridView1.Columns[1].HeaderText = "サイト名";
@@ -204,9 +212,9 @@
204
212
 
205
213
  dataGridView1.Columns[5].HeaderText = "備考";
206
214
 
207
-
215
+ trans.Commit();
208
-
216
+
209
- cmd.ExecuteNonQuery();
217
+ cn.Close();
210
218
 
211
219
 
212
220
 
@@ -214,6 +222,64 @@
214
222
 
215
223
  }
216
224
 
225
+ //string dbConnectionString = "Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3";
226
+
227
+ ////string dbConnectionString = "Data Source = C:\\Users/Takaaki Kawabe/Desktop/WindowsFormsApplication4 /myfriend.sqlite3";
228
+
229
+ //using (SQLiteConnection cn = new SQLiteConnection(dbConnectionString))
230
+
231
+ //{
232
+
233
+ // cn.Open();
234
+
235
+ // using (SQLiteTransaction trans = cn.BeginTransaction())
236
+
237
+ // {
238
+
239
+ // SQLiteCommand cmd = cn.CreateCommand();
240
+
241
+ // //select文を走らせる
242
+
243
+ // cmd.CommandText = "SELECT * from PASS_KANRI where SiteNm = @SiteNm";
244
+
245
+
246
+
247
+ // //パラメータのセット
248
+
249
+ // cmd.Parameters.Add("SiteNm", System.Data.DbType.String);
250
+
251
+
252
+
253
+ // cmd.Parameters["SiteNm"].Value = txtSiteNm.Text;
254
+
255
+
256
+
257
+ // //データグリッドビューのクリア
258
+
259
+ // datatable.Clear();
260
+
261
+
262
+
263
+ // var Datatable = new DataTable();
264
+
265
+ // dataGridView1.DataSource = datatable;
266
+
267
+
268
+
269
+ // dataGridView1.Columns[0].HeaderText = "No";
270
+
271
+ // dataGridView1.Columns[1].HeaderText = "サイト名";
272
+
273
+ // dataGridView1.Columns[2].HeaderText = "ログインIDまたはEmail等";
274
+
275
+ // dataGridView1.Columns[3].HeaderText = "パスワード";
276
+
277
+ // dataGridView1.Columns[4].HeaderText = "登録日";
278
+
279
+ // dataGridView1.Columns[5].HeaderText = "備考";
280
+
281
+
282
+
217
283
  }
218
284
 
219
285
  }
@@ -252,7 +318,51 @@
252
318
 
253
319
  {
254
320
 
321
+ //DataGridViewの内容をコピー
322
+
255
- //Clipboard.SetDataObject(dataGridView1.GetClipboardContent());
323
+ Clipboard.SetDataObject(dataGridView1.GetClipboardContent());
324
+
325
+ }
326
+
327
+
328
+
329
+ private void Itiran_Load(object sender, EventArgs e)
330
+
331
+ {
332
+
333
+
334
+
335
+ }
336
+
337
+
338
+
339
+ private void Itiran_KeyDown(object sender, KeyEventArgs e)
340
+
341
+ {
342
+
343
+ //Enterキーでコントロール遷移
344
+
345
+ if (e.KeyCode == Keys.Enter)
346
+
347
+ {
348
+
349
+ if (e.Shift)
350
+
351
+ {
352
+
353
+ ProcessTabKey(false);
354
+
355
+ }
356
+
357
+ else
358
+
359
+ {
360
+
361
+ ProcessTabKey(true);
362
+
363
+ }
364
+
365
+ }
256
366
 
257
367
  }
258
368
 
@@ -262,4 +372,6 @@
262
372
 
263
373
 
264
374
 
375
+
376
+
265
377
  ```