質問編集履歴

1

追記

2017/07/27 15:28

投稿

chintao1224
chintao1224

スコア155

test CHANGED
File without changes
test CHANGED
@@ -39,3 +39,55 @@
39
39
 
40
40
 
41
41
  コード自体間違っているのでしょうか。
42
+
43
+
44
+
45
+ ソースをまとめてみました。
46
+
47
+
48
+
49
+ ```vb.net
50
+
51
+ Dim npgCnct As NpgsqlConnection
52
+
53
+ Dim npgCmnd As NpgsqlCommand
54
+
55
+ Dim npgDR As NpgsqlDataReader
56
+
57
+ Dim strSql As String
58
+
59
+
60
+
61
+ npgCnct = New Npgsql.NpgsqlConnection
62
+
63
+ npgCnct.ConnectionString = "Server=localhost;Port=5432;User Id=user1;Password=pass;Database=TESTDB;"
64
+
65
+ npgCnct.Open()
66
+
67
+
68
+
69
+ strSql = "SELECT * FROM public.TEST;"
70
+
71
+
72
+
73
+ npgCmnd = New NpgsqlCommand
74
+
75
+ npgCmnd.Connection = npgCnct
76
+
77
+ npgCmnd.CommandText = strSql
78
+
79
+ npgDR = npgCmnd.ExecuteReader()
80
+
81
+ ```
82
+
83
+
84
+
85
+ やはりnpgDR = npgCmnd.ExecuteReader()のところで下記のエラーが出ます。
86
+
87
+
88
+
89
+ 「Npgsql.PostgresException: '外部コンポーネントが例外をスローしました。'」
90
+
91
+
92
+
93
+ なぜエラーになるのでしょうか?