我正在创建一个控制台应用程序,并且在 app.config 文件中有一个连接字符串。当我尝试在我的代码中引用它时,我在配置管理器上得到一个错误(即它的下划线)。
Public Function getTPLvalue() As String
Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("GasNominationsConnectionString").ConnectionString)
conn.Open()
Dim cmd As New SqlCommand("select tpl from JADhist where dateSubmitted = (select MAX(datesubmitted) from JADhist)", conn)
Dim TPL As String = (cmd.ExecuteScalar())
conn.Close()
Return TPL
End Function
有任何想法吗