質問するログイン新規登録

質問編集履歴

9

使っているツールのバージョンなど補足情報を追加いたしました。

2021/04/07 07:07

投稿

rarara_123
rarara_123

スコア11

title CHANGED
File without changes
body CHANGED
@@ -64,10 +64,11 @@
64
64
 
65
65
  使っているツールのバージョンなど補足情報
66
66
  ACCESSのバージョン2103
67
- VB.netでWindows10の64ビット
67
+ Windows10の64ビット
68
+ WindowsFormsを作成
68
- Visual Studioを使用してます。
69
+ Visual Studio2019
70
+ NET Framework 4.8を使用してます。
69
71
 
70
-
71
72
  以上となります。
72
73
 
73
74
  ご教示よろしくお願い致します。

8

ダブルクォートを追加いたします。

2021/04/07 07:07

投稿

rarara_123
rarara_123

スコア11

title CHANGED
File without changes
body CHANGED
@@ -1,5 +1,5 @@
1
1
  前提・実現したいこと
2
- VB.NETからAccessのデータを取得したいです。
2
+ VB.NETAccessのデータを取得したいです。
3
3
 
4
4
  発生している問題・エラーメッセージ
5
5
  BC30590 イベントLoadが見つかりません。とエラーが表示されます。

7

ダブルクォートを追加いたします。

2021/04/07 06:41

投稿

rarara_123
rarara_123

スコア11

title CHANGED
@@ -1,1 +1,1 @@
1
- VB.NETからAccessのデータを取得したいです。
1
+ VB.NETAccessのデータを取得したいです。
body CHANGED
File without changes

6

ダブルクォートを追加いたします。

2021/04/07 06:41

投稿

rarara_123
rarara_123

スコア11

title CHANGED
File without changes
body CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  発生している問題・エラーメッセージ
5
5
  BC30590 イベントLoadが見つかりません。とエラーが表示されます。
6
+ エラーは二行目「 Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load」の最後のLoadで発生してます。
6
7
 
7
8
  該当のソースコード
8
9
 
@@ -62,9 +63,11 @@
62
63
  VBとACCESSの接続は問題ないと思います。
63
64
 
64
65
  使っているツールのバージョンなど補足情報
65
- windows10 64ビット
66
66
  ACCESSのバージョン2103
67
+ VB.netでWindows10の64ビット
68
+ Visual Studioを使用してます。
67
69
 
70
+
68
71
  以上となります。
69
72
 
70
73
  ご教示よろしくお願い致します。

5

ダブルクォートを追加いたします。

2021/04/07 06:23

投稿

rarara_123
rarara_123

スコア11

title CHANGED
File without changes
body CHANGED
@@ -8,110 +8,55 @@
8
8
 
9
9
  ```
10
10
  Public Class frmConnectAccessDB
11
- ```
12
- ```
13
- Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load
11
+ Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load
14
- ```
15
12
 
16
- 'SQL作成
13
+ 'SQL作成
14
+ Dim resultDt As New DataTable
15
+ Dim sql = New System.Text.StringBuilder()
16
+ sql.AppendLine("SELECT")
17
+ sql.AppendLine(" *")
18
+ sql.AppendLine("FROM ID給料")
17
19
 
18
- ```
19
- Dim resultDt As New DataTable
20
- ```
21
- ```
22
- Dim sql = New System.Text.StringBuilder()
23
- ```
24
- ```
25
- sql.AppendLine("SELECT")
26
- ```
27
- ```
28
- sql.AppendLine(" *")
29
- ```
30
- ```
31
- sql.AppendLine("FROM ID給料")
32
- ```
33
-
34
20
  'Access接続準備
35
- ```
36
- Dim command As New OleDbCommand
21
+ Dim command As New OleDbCommand
37
- ```
38
- ```
39
- Dim da As New OleDbDataAdapter
22
+ Dim da As New OleDbDataAdapter
40
- ```
41
- ```
42
- Dim cnAccess As OleDbConnection = New OleDbConnection
23
+ Dim cnAccess As OleDbConnection = New OleDbConnection
43
- cnAccess.ConnectionString = My.Settings.アクセス
24
+ cnAccess.ConnectionString = My.Settings.アクセス
44
- ```
45
25
 
46
26
  'Access接続開始
47
- ```
48
- cnAccess.Open()
27
+ cnAccess.Open()
49
- ```
50
- ```
51
- Try
52
- ```
53
- ```
54
- command.Connection = cnAccess
55
- ```
56
- ```
57
- command.CommandText = sql.ToString
58
- ```
59
- ```
60
- da.SelectCommand = command
61
- ```
62
28
 
63
- 'SQL実行 結果をデータテーブルに格納
64
- ```
65
- da.Fill(resultDt)
66
- ```
67
- ```
68
- Catch ex As Exception
69
- ```
70
- ```
71
- Throw
29
+ Try
72
- ```
73
- ```
74
- Finally
75
- ```
76
- ```
77
- command.Dispose()
78
- ```
79
- ```
80
- da.Dispose()
81
- ```
82
- ```
83
- cnAccess.Close()
84
- ```
85
- ```
86
- End Try
87
- ```
88
30
 
31
+ command.Connection = cnAccess
32
+ command.CommandText = sql.ToString
89
- 'データテーブルの結果を表示
33
+ da.SelectCommand = command
90
34
 
35
+ 'SQL実行 結果をデータテーブルに格納
36
+ da.Fill(resultDt)
37
+
38
+
39
+ Catch ex As Exception
40
+ Throw
41
+ Finally
42
+ command.Dispose()
43
+ da.Dispose()
44
+ cnAccess.Close()
45
+ End Try
46
+
47
+ 'データテーブルの結果を表示
48
+ For rowindex As Integer = 0 To resultDt.Rows.Count - 1
49
+ For colindex As Integer = 0 To resultDt.Columns.Count - 1
50
+ Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")
51
+ Next
52
+ Console.WriteLine()
53
+ Next
54
+
55
+ End Sub
56
+ End Class
57
+
58
+
91
59
  ```
92
- For rowindex As Integer = 0 To resultDt.Rows.Count - 1
93
- ```
94
- ```
95
- For colindex As Integer = 0 To resultDt.Columns.Count - 1
96
- ```
97
- ```
98
- Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")
99
- ```
100
- ```
101
- Next
102
- ```
103
- ```
104
- Console.WriteLine()
105
- ```
106
- ```
107
- Next
108
- ```
109
- ```
110
- End Sub
111
- ```
112
- ```
113
- End Class
114
- ```
115
60
 
116
61
  自分で調べたことや試したこと
117
62
  VBとACCESSの接続は問題ないと思います。

4

ダブルクォートを追加いたします。

2021/04/07 06:20

投稿

rarara_123
rarara_123

スコア11

title CHANGED
File without changes
body CHANGED
@@ -6,54 +6,113 @@
6
6
 
7
7
  該当のソースコード
8
8
 
9
+ ```
9
- ```Public Class frmConnectAccessDB```
10
+ Public Class frmConnectAccessDB
11
+ ```
12
+ ```
10
- ```Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load```
13
+ Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load
14
+ ```
11
15
 
12
- 'SQL作成
16
+ 'SQL作成
13
- ```Dim resultDt As New DataTable```
14
- ```Dim sql = New System.Text.StringBuilder()```
15
- ```sql.AppendLine("SELECT")```
16
- ```sql.AppendLine(" *")```
17
- ```sql.AppendLine("FROM ID給料")```
18
17
 
18
+ ```
19
+ Dim resultDt As New DataTable
20
+ ```
21
+ ```
22
+ Dim sql = New System.Text.StringBuilder()
23
+ ```
24
+ ```
25
+ sql.AppendLine("SELECT")
26
+ ```
27
+ ```
28
+ sql.AppendLine(" *")
29
+ ```
30
+ ```
31
+ sql.AppendLine("FROM ID給料")
32
+ ```
33
+
19
34
  'Access接続準備
35
+ ```
20
- ```Dim command As New OleDbCommand```
36
+ Dim command As New OleDbCommand
37
+ ```
38
+ ```
21
- ```Dim da As New OleDbDataAdapter```
39
+ Dim da As New OleDbDataAdapter
40
+ ```
41
+ ```
22
- ```Dim cnAccess As OleDbConnection = New OleDbConnection```
42
+ Dim cnAccess As OleDbConnection = New OleDbConnection
23
- cnAccess.ConnectionString = My.Settings.アクセス```
43
+ cnAccess.ConnectionString = My.Settings.アクセス
44
+ ```
24
45
 
25
46
  'Access接続開始
47
+ ```
26
- ```cnAccess.Open()```
48
+ cnAccess.Open()
49
+ ```
50
+ ```
51
+ Try
52
+ ```
53
+ ```
54
+ command.Connection = cnAccess
55
+ ```
56
+ ```
57
+ command.CommandText = sql.ToString
58
+ ```
59
+ ```
60
+ da.SelectCommand = command
61
+ ```
27
62
 
63
+ 'SQL実行 結果をデータテーブルに格納
64
+ ```
65
+ da.Fill(resultDt)
66
+ ```
67
+ ```
68
+ Catch ex As Exception
69
+ ```
70
+ ```
71
+ Throw
72
+ ```
73
+ ```
74
+ Finally
75
+ ```
76
+ ```
77
+ command.Dispose()
78
+ ```
79
+ ```
80
+ da.Dispose()
81
+ ```
82
+ ```
83
+ cnAccess.Close()
84
+ ```
85
+ ```
28
- ```Try```
86
+ End Try
87
+ ```
29
88
 
30
- ```command.Connection = cnAccess```
31
- ```command.CommandText = sql.ToString```
32
- ```da.SelectCommand = command```
89
+ 'データテーブルの結果を表示
33
90
 
91
+ ```
34
- 'SQL実行 結果をデータテーブルに格納
92
+ For rowindex As Integer = 0 To resultDt.Rows.Count - 1
93
+ ```
94
+ ```
95
+ For colindex As Integer = 0 To resultDt.Columns.Count - 1
96
+ ```
97
+ ```
98
+ Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")
99
+ ```
100
+ ```
101
+ Next
102
+ ```
103
+ ```
35
- ```da.Fill(resultDt)```
104
+ Console.WriteLine()
105
+ ```
106
+ ```
107
+ Next
108
+ ```
109
+ ```
110
+ End Sub
111
+ ```
112
+ ```
113
+ End Class
114
+ ```
36
115
 
37
-
38
- ```Catch ex As Exception```
39
- ```Throw```
40
- ```Finally
41
- command.Dispose()
42
- da.Dispose()
43
- cnAccess.Close()```
44
- ```End Try```
45
-
46
- 'データテーブルの結果を表示
47
- ```For rowindex As Integer = 0 To resultDt.Rows.Count - 1```
48
- ```For colindex As Integer = 0 To resultDt.Columns.Count - 1```
49
- ```Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")```
50
- ```Next```
51
- ```Console.WriteLine()```
52
- ```Next```
53
-
54
- ```End Sub```
55
- ```End Class```
56
-
57
116
  自分で調べたことや試したこと
58
117
  VBとACCESSの接続は問題ないと思います。
59
118
 

3

ダブルクォートを追加いたします。

2021/04/07 06:07

投稿

rarara_123
rarara_123

スコア11

title CHANGED
File without changes
body CHANGED
@@ -5,55 +5,55 @@
5
5
  BC30590 イベントLoadが見つかりません。とエラーが表示されます。
6
6
 
7
7
  該当のソースコード
8
- ```Public Class frmConnectAccessDB
9
- Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load
10
8
 
9
+ ```Public Class frmConnectAccessDB```
10
+ ```Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load```
11
+
11
12
  'SQL作成
12
- Dim resultDt As New DataTable
13
+ ```Dim resultDt As New DataTable```
13
- Dim sql = New System.Text.StringBuilder()
14
+ ```Dim sql = New System.Text.StringBuilder()```
14
- sql.AppendLine("SELECT")
15
+ ```sql.AppendLine("SELECT")```
15
- sql.AppendLine(" *")
16
+ ```sql.AppendLine(" *")```
16
- sql.AppendLine("FROM ID給料")
17
+ ```sql.AppendLine("FROM ID給料")```
17
18
 
18
19
  'Access接続準備
19
- Dim command As New OleDbCommand
20
+ ```Dim command As New OleDbCommand```
20
- Dim da As New OleDbDataAdapter
21
+ ```Dim da As New OleDbDataAdapter```
21
- Dim cnAccess As OleDbConnection = New OleDbConnection
22
+ ```Dim cnAccess As OleDbConnection = New OleDbConnection```
22
- cnAccess.ConnectionString = My.Settings.アクセス
23
+ cnAccess.ConnectionString = My.Settings.アクセス```
23
24
 
24
25
  'Access接続開始
25
- cnAccess.Open()
26
+ ```cnAccess.Open()```
26
27
 
27
- Try
28
+ ```Try```
28
29
 
29
- command.Connection = cnAccess
30
+ ```command.Connection = cnAccess```
30
- command.CommandText = sql.ToString
31
+ ```command.CommandText = sql.ToString```
31
- da.SelectCommand = command
32
+ ```da.SelectCommand = command```
32
33
 
33
34
  'SQL実行 結果をデータテーブルに格納
34
- da.Fill(resultDt)
35
+ ```da.Fill(resultDt)```
35
36
 
36
37
 
37
- Catch ex As Exception
38
+ ```Catch ex As Exception```
38
- Throw
39
+ ```Throw```
39
- Finally
40
+ ```Finally
40
41
  command.Dispose()
41
42
  da.Dispose()
42
- cnAccess.Close()
43
+ cnAccess.Close()```
43
- End Try
44
+ ```End Try```
44
45
 
45
46
  'データテーブルの結果を表示
46
- For rowindex As Integer = 0 To resultDt.Rows.Count - 1
47
+ ```For rowindex As Integer = 0 To resultDt.Rows.Count - 1```
47
- For colindex As Integer = 0 To resultDt.Columns.Count - 1
48
+ ```For colindex As Integer = 0 To resultDt.Columns.Count - 1```
48
- Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")
49
+ ```Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")```
49
- Next
50
+ ```Next```
50
- Console.WriteLine()
51
+ ```Console.WriteLine()```
51
- Next
52
+ ```Next```
52
53
 
53
- End Sub
54
+ ```End Sub```
54
- End Class```
55
+ ```End Class```
55
56
 
56
-
57
57
  自分で調べたことや試したこと
58
58
  VBとACCESSの接続は問題ないと思います。
59
59
 

2

ダブルクォートを追加いたします。

2021/04/07 05:46

投稿

rarara_123
rarara_123

スコア11

title CHANGED
File without changes
body CHANGED
@@ -5,54 +5,55 @@
5
5
  BC30590 イベントLoadが見つかりません。とエラーが表示されます。
6
6
 
7
7
  該当のソースコード
8
- ```Public Class frmConnectAccessDB```
8
+ ```Public Class frmConnectAccessDB
9
- ```Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load```
9
+ Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load
10
10
 
11
11
  'SQL作成
12
- ```Dim resultDt As New DataTable```
12
+ Dim resultDt As New DataTable
13
- ```Dim sql = New System.Text.StringBuilder()```
13
+ Dim sql = New System.Text.StringBuilder()
14
- ```sql.AppendLine("SELECT")```
14
+ sql.AppendLine("SELECT")
15
- ```sql.AppendLine(" *")```
15
+ sql.AppendLine(" *")
16
- ```sql.AppendLine("FROM ID給料")```
16
+ sql.AppendLine("FROM ID給料")
17
17
 
18
18
  'Access接続準備
19
- ```Dim command As New OleDbCommand```
19
+ Dim command As New OleDbCommand
20
- ```Dim da As New OleDbDataAdapter```
20
+ Dim da As New OleDbDataAdapter
21
- ```Dim cnAccess As OleDbConnection = New OleDbConnection
21
+ Dim cnAccess As OleDbConnection = New OleDbConnection
22
- cnAccess.ConnectionString = My.Settings.アクセス```
22
+ cnAccess.ConnectionString = My.Settings.アクセス
23
23
 
24
24
  'Access接続開始
25
- ```cnAccess.Open()```
25
+ cnAccess.Open()
26
26
 
27
- ```Try```
27
+ Try
28
28
 
29
- ```command.Connection = cnAccess```
29
+ command.Connection = cnAccess
30
- ```command.CommandText = sql.ToString```
30
+ command.CommandText = sql.ToString
31
- ```da.SelectCommand = command```
31
+ da.SelectCommand = command
32
32
 
33
33
  'SQL実行 結果をデータテーブルに格納
34
- ```da.Fill(resultDt)```
34
+ da.Fill(resultDt)
35
35
 
36
36
 
37
- ```Catch ex As Exception```
37
+ Catch ex As Exception
38
- ```Throw```
38
+ Throw
39
- ```Finally```
39
+ Finally
40
- ```command.Dispose()```
40
+ command.Dispose()
41
- ```da.Dispose()```
41
+ da.Dispose()
42
- ```cnAccess.Close()```
42
+ cnAccess.Close()
43
- ```End Try```
43
+ End Try
44
44
 
45
45
  'データテーブルの結果を表示
46
- ```For rowindex As Integer = 0 To resultDt.Rows.Count - 1```
46
+ For rowindex As Integer = 0 To resultDt.Rows.Count - 1
47
- ```For colindex As Integer = 0 To resultDt.Columns.Count - 1```
47
+ For colindex As Integer = 0 To resultDt.Columns.Count - 1
48
- ```Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")```
48
+ Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")
49
- ```Next```
49
+ Next
50
- ```Console.WriteLine()```
50
+ Console.WriteLine()
51
- ```Next```
51
+ Next
52
52
 
53
- ```End Sub```
53
+ End Sub
54
- ```End Class```
54
+ End Class```
55
55
 
56
+
56
57
  自分で調べたことや試したこと
57
58
  VBとACCESSの接続は問題ないと思います。
58
59
 

1

コードにバッククォートを追加いたしました。

2021/04/07 05:40

投稿

rarara_123
rarara_123

スコア11

title CHANGED
File without changes
body CHANGED
@@ -5,53 +5,53 @@
5
5
  BC30590 イベントLoadが見つかりません。とエラーが表示されます。
6
6
 
7
7
  該当のソースコード
8
- Public Class frmConnectAccessDB
8
+ ```Public Class frmConnectAccessDB```
9
- Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load
9
+ ```Private Sub frmConnectAccessDB_Load(sender As Object, e As EventArgs) Handles MyBase.Load```
10
10
 
11
11
  'SQL作成
12
- Dim resultDt As New DataTable
12
+ ```Dim resultDt As New DataTable```
13
- Dim sql = New System.Text.StringBuilder()
13
+ ```Dim sql = New System.Text.StringBuilder()```
14
- sql.AppendLine("SELECT")
14
+ ```sql.AppendLine("SELECT")```
15
- sql.AppendLine(" *")
15
+ ```sql.AppendLine(" *")```
16
- sql.AppendLine("FROM ID給料")
16
+ ```sql.AppendLine("FROM ID給料")```
17
17
 
18
18
  'Access接続準備
19
- Dim command As New OleDbCommand
19
+ ```Dim command As New OleDbCommand```
20
- Dim da As New OleDbDataAdapter
20
+ ```Dim da As New OleDbDataAdapter```
21
- Dim cnAccess As OleDbConnection = New OleDbConnection
21
+ ```Dim cnAccess As OleDbConnection = New OleDbConnection
22
- cnAccess.ConnectionString = My.Settings.アクセス
22
+ cnAccess.ConnectionString = My.Settings.アクセス```
23
23
 
24
24
  'Access接続開始
25
- cnAccess.Open()
25
+ ```cnAccess.Open()```
26
26
 
27
- Try
27
+ ```Try```
28
28
 
29
- command.Connection = cnAccess
29
+ ```command.Connection = cnAccess```
30
- command.CommandText = sql.ToString
30
+ ```command.CommandText = sql.ToString```
31
- da.SelectCommand = command
31
+ ```da.SelectCommand = command```
32
32
 
33
33
  'SQL実行 結果をデータテーブルに格納
34
- da.Fill(resultDt)
34
+ ```da.Fill(resultDt)```
35
35
 
36
36
 
37
- Catch ex As Exception
37
+ ```Catch ex As Exception```
38
- Throw
38
+ ```Throw```
39
- Finally
39
+ ```Finally```
40
- command.Dispose()
40
+ ```command.Dispose()```
41
- da.Dispose()
41
+ ```da.Dispose()```
42
- cnAccess.Close()
42
+ ```cnAccess.Close()```
43
- End Try
43
+ ```End Try```
44
44
 
45
45
  'データテーブルの結果を表示
46
- For rowindex As Integer = 0 To resultDt.Rows.Count - 1
46
+ ```For rowindex As Integer = 0 To resultDt.Rows.Count - 1```
47
- For colindex As Integer = 0 To resultDt.Columns.Count - 1
47
+ ```For colindex As Integer = 0 To resultDt.Columns.Count - 1```
48
- Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")
48
+ ```Console.Write(resultDt.Rows(rowindex).Item(colindex).ToString & " ")```
49
- Next
49
+ ```Next```
50
- Console.WriteLine()
50
+ ```Console.WriteLine()```
51
- Next
51
+ ```Next```
52
52
 
53
- End Sub
53
+ ```End Sub```
54
- End Class
54
+ ```End Class```
55
55
 
56
56
  自分で調べたことや試したこと
57
57
  VBとACCESSの接続は問題ないと思います。