質問編集履歴
2
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -39,4 +39,28 @@
|
|
39
39
|
"Provider = Microsoft.ACE.OLEDB.12.0; Data Source =
|
40
40
|
C:\Users\xxxx\OneDrive\共有\DataBase\test2.accdb"
|
41
41
|
コード
|
42
|
+
```
|
43
|
+
|
44
|
+
SQL実行クラス
|
45
|
+
``` protected bool ExecuteNonQuery(String queryString)
|
46
|
+
{
|
47
|
+
try
|
48
|
+
{
|
49
|
+
//connection.Open();
|
50
|
+
System.Data.OleDb.OleDbCommand command = connection.CreateCommand();
|
51
|
+
command.CommandText = queryString;
|
52
|
+
command.CommandTimeout = 30;
|
53
|
+
command.ExecuteNonQuery();
|
54
|
+
command.Dispose();
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
catch (Exception ex)
|
58
|
+
{
|
59
|
+
returnMessage = ex.Message;
|
60
|
+
Log.Write(returnMessage + queryString);
|
61
|
+
connection.Close();
|
62
|
+
return false;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
コード
|
42
66
|
```
|
1
追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,4 +25,18 @@
|
|
25
25
|
すでに主キーが設定されている旨のエラーが出ますので、DataTableの作成には問題無いと思います。
|
26
26
|
|
27
27
|
上記の方法に問題があるのか、他の方法があるのか、教えて頂けないでしょうか。
|
28
|
-
宜しくお願い致します。
|
28
|
+
宜しくお願い致します。
|
29
|
+
|
30
|
+
データベース?は"Microsoft.ACE.OLEDB.12.0"を使用しています。
|
31
|
+
AccDBファイルの作成
|
32
|
+
```
|
33
|
+
ADOX.Catalog cat = new Catalog();
|
34
|
+
cat.Create(DBSource);
|
35
|
+
OleDbConnection connection = new
|
36
|
+
OleDbConnection(Builder.ConnectionString);
|
37
|
+
|
38
|
+
DBSourceの内容
|
39
|
+
"Provider = Microsoft.ACE.OLEDB.12.0; Data Source =
|
40
|
+
C:\Users\xxxx\OneDrive\共有\DataBase\test2.accdb"
|
41
|
+
コード
|
42
|
+
```
|