質問編集履歴
1
あかん
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,20 +92,94 @@
|
|
92
92
|
|
93
93
|
{
|
94
94
|
|
95
|
-
//using (SQLiteConnection con = myfriend.sqlite3"))
|
96
|
-
|
97
|
-
using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/myfriend.sqlite3"))
|
98
|
-
|
99
|
-
|
95
|
+
//検索条件がない場合
|
100
|
-
|
96
|
+
|
101
|
-
|
97
|
+
if (txtSiteNm.Text == "")
|
98
|
+
|
99
|
+
{
|
100
|
+
|
101
|
+
//using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/BC049/Desktop/WindowsFormsApplication4/myfriend.sqlite3"))
|
102
|
+
|
103
|
+
using (SQLiteConnection con = new SQLiteConnection("Data Source = C:\\Users/Takaaki Kawabe/Desktop/WindowsFormsApplication4 /myfriend.sqlite3"))
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
using (SQLiteDataAdapter adapter = new SQLiteDataAdapter("select * from PASS_KANRI", con))
|
102
108
|
|
103
109
|
{
|
104
110
|
|
111
|
+
//データグリッドビューのクリア
|
112
|
+
|
113
|
+
datatable.Clear();
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
var Datatable = new DataTable();
|
118
|
+
|
119
|
+
dataGridView1.DataSource = datatable;
|
120
|
+
|
121
|
+
adapter.Fill(datatable);
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
//dataGridView1.Columns[0].HeaderText = "ID";
|
126
|
+
|
127
|
+
//No,SiteNm,LoginId,Password,BIKO カラム順
|
128
|
+
|
129
|
+
//テーブルの内容表示
|
130
|
+
|
131
|
+
dataGridView1.Columns[0].HeaderText = "No";
|
132
|
+
|
133
|
+
dataGridView1.Columns[1].HeaderText = "サイト名";
|
134
|
+
|
135
|
+
dataGridView1.Columns[2].HeaderText = "ログインIDまたはEmail等";
|
136
|
+
|
137
|
+
dataGridView1.Columns[3].HeaderText = "パスワード";
|
138
|
+
|
139
|
+
dataGridView1.Columns[4].HeaderText = "登録日";
|
140
|
+
|
141
|
+
dataGridView1.Columns[5].HeaderText = "備考";
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
}
|
148
|
+
|
149
|
+
else
|
150
|
+
|
151
|
+
{
|
152
|
+
|
153
|
+
string dbConnectionString = "Data Source = C:\\Users/Takaaki Kawabe/Desktop/WindowsFormsApplication4 /myfriend.sqlite3";
|
154
|
+
|
105
|
-
|
155
|
+
using (SQLiteConnection cn = new SQLiteConnection(dbConnectionString))
|
156
|
+
|
157
|
+
{
|
158
|
+
|
159
|
+
cn.Open();
|
160
|
+
|
161
|
+
using (SQLiteTransaction trans = cn.BeginTransaction())
|
106
162
|
|
107
163
|
{
|
108
164
|
|
165
|
+
SQLiteCommand cmd = cn.CreateCommand();
|
166
|
+
|
167
|
+
//select文を走らせる
|
168
|
+
|
169
|
+
cmd.CommandText = "SELECT * from PASS_KANRI where SiteNm = @SiteNm";
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
//パラメータのセット
|
174
|
+
|
175
|
+
cmd.Parameters.Add("SiteNm", System.Data.DbType.String);
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
cmd.Parameters["SiteNm"].Value = txtSiteNm.Text;
|
180
|
+
|
181
|
+
|
182
|
+
|
109
183
|
//データグリッドビューのクリア
|
110
184
|
|
111
185
|
datatable.Clear();
|
@@ -116,15 +190,7 @@
|
|
116
190
|
|
117
191
|
dataGridView1.DataSource = datatable;
|
118
192
|
|
119
|
-
|
193
|
+
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
//dataGridView1.Columns[0].HeaderText = "ID";
|
124
|
-
|
125
|
-
//No,SiteNm,LoginId,Password,BIKO カラム順
|
126
|
-
|
127
|
-
//テーブルの内容表示
|
128
194
|
|
129
195
|
dataGridView1.Columns[0].HeaderText = "No";
|
130
196
|
|
@@ -140,89 +206,79 @@
|
|
140
206
|
|
141
207
|
|
142
208
|
|
209
|
+
cmd.ExecuteNonQuery();
|
210
|
+
|
211
|
+
|
212
|
+
|
143
213
|
}
|
144
214
|
|
215
|
+
//using (SQLiteDataAdapter adapter = new SQLiteDataAdapter("select * from PASS_KANRI where SiteNm = ?", con))
|
216
|
+
|
217
|
+
//{
|
218
|
+
|
219
|
+
// //using (SQLiteCommand cmd = con.CreateCommand())
|
220
|
+
|
221
|
+
// //{
|
222
|
+
|
223
|
+
// // //パラメータのセットと確定
|
224
|
+
|
225
|
+
// cmd.Parameters.Add(new SQLiteParameter(DbType.String, textSiteNm));
|
226
|
+
|
227
|
+
// cmd.Prepare();
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
// //ExecuteReaderするとreaderが帰ってくる
|
232
|
+
|
233
|
+
// using (SQLiteDataReader reader = cmd.ExecuteReader())
|
234
|
+
|
235
|
+
// {
|
236
|
+
|
237
|
+
// //行の読み込み
|
238
|
+
|
239
|
+
// while (reader.Read())
|
240
|
+
|
241
|
+
// {
|
242
|
+
|
243
|
+
// //データグリッドビューのクリア
|
244
|
+
|
245
|
+
// datatable.Clear();
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
// var Datatable = new DataTable();
|
250
|
+
|
251
|
+
// dataGridView1.DataSource = datatable;
|
252
|
+
|
253
|
+
// //テーブルの内容表示
|
254
|
+
|
255
|
+
// dataGridView1.Columns[0].HeaderText = "No";
|
256
|
+
|
257
|
+
// dataGridView1.Columns[1].HeaderText = "サイト名";
|
258
|
+
|
259
|
+
// dataGridView1.Columns[2].HeaderText = "ログインIDまたはEmail等";
|
260
|
+
|
261
|
+
// dataGridView1.Columns[3].HeaderText = "パスワード";
|
262
|
+
|
263
|
+
// dataGridView1.Columns[4].HeaderText = "登録日";
|
264
|
+
|
265
|
+
// dataGridView1.Columns[5].HeaderText = "備考";
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
// }
|
270
|
+
|
271
|
+
// }
|
272
|
+
|
273
|
+
//}
|
274
|
+
|
275
|
+
|
276
|
+
|
145
277
|
}
|
146
278
|
|
147
|
-
else
|
148
|
-
|
149
|
-
{
|
150
|
-
|
151
|
-
using (SQLiteDataAdapter adapter = new SQLiteDataAdapter("select * from PASS_KANRI where SiteNm = ?", con))
|
152
|
-
|
153
|
-
{
|
154
|
-
|
155
|
-
using (SQLiteCommand cmd = con.CreateCommand())
|
156
|
-
|
157
|
-
{
|
158
|
-
|
159
|
-
//パラメータのセットと確定
|
160
|
-
|
161
|
-
cmd.Parameters.Add(new SQLiteParameter(DbType.String, textSiteNm));
|
162
|
-
|
163
|
-
cmd.Prepare();
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
//ExecuteReaderするとreaderが帰ってくる
|
168
|
-
|
169
|
-
using (SQLiteDataReader reader = cmd.ExecuteReader())
|
170
|
-
|
171
|
-
{
|
172
|
-
|
173
|
-
//行の読み込み
|
174
|
-
|
175
|
-
while (reader.Read())
|
176
|
-
|
177
|
-
{
|
178
|
-
|
179
|
-
//データグリッドビューのクリア
|
180
|
-
|
181
|
-
datatable.Clear();
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
var Datatable = new DataTable();
|
186
|
-
|
187
|
-
dataGridView1.DataSource = datatable;
|
188
|
-
|
189
|
-
//テーブルの内容表示
|
190
|
-
|
191
|
-
dataGridView1.Columns[0].HeaderText = "No";
|
192
|
-
|
193
|
-
dataGridView1.Columns[1].HeaderText = "サイト名";
|
194
|
-
|
195
|
-
dataGridView1.Columns[2].HeaderText = "ログインIDまたはEmail等";
|
196
|
-
|
197
|
-
dataGridView1.Columns[3].HeaderText = "パスワード";
|
198
|
-
|
199
|
-
dataGridView1.Columns[4].HeaderText = "登録日";
|
200
|
-
|
201
|
-
dataGridView1.Columns[5].HeaderText = "備考";
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
279
|
+
}
|
206
|
-
|
280
|
+
|
207
|
-
|
281
|
+
}
|
208
|
-
|
209
|
-
}
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
}
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
282
|
|
227
283
|
/// <summary>
|
228
284
|
|
@@ -256,4 +312,6 @@
|
|
256
312
|
|
257
313
|
|
258
314
|
|
315
|
+
|
316
|
+
|
259
317
|
```
|