基于VB的asp.net ConnectionString 属性尚未初始化。
我的程序是这样的:PublicSubNew(ByValintOrderIdAsInteger)_strConn=System.Configuration.Configur...
我的程序是这样的:
Public Sub New(ByVal intOrderId As Integer)
_strConn = System.Configuration.ConfigurationManager.AppSettings("strConn")
Dim conn As New SqlConnection(_strConn)
Dim strSql As String = "Select * From 个人订单 Where 个人订单id=" & intOrderId
Dim cmd As New SqlCommand(strSql,conn)
conn.Open()
Dim dr As SqlDataReader=cmd.ExecuteReader dr.Read()
个人订单id = dr.Item("个人订单id")
username = dr.Item("username")
总数量 = dr.Item("总数量")
总金额 = dr.Item("总金额")
为什么出现ConnectionString 属性尚未初始化。请教各位大虾!谢谢了
我的webconfig里有
<configuration>
<appSettings/>
<connectionStrings>
<add name="dingxiConnectionString" connectionString="Data Source=5288005ac55345f.;Initial Catalog=dingxi;User ID=sa"
providerName="System.Data.SqlClient" />
</connectionStrings> 展开
Public Sub New(ByVal intOrderId As Integer)
_strConn = System.Configuration.ConfigurationManager.AppSettings("strConn")
Dim conn As New SqlConnection(_strConn)
Dim strSql As String = "Select * From 个人订单 Where 个人订单id=" & intOrderId
Dim cmd As New SqlCommand(strSql,conn)
conn.Open()
Dim dr As SqlDataReader=cmd.ExecuteReader dr.Read()
个人订单id = dr.Item("个人订单id")
username = dr.Item("username")
总数量 = dr.Item("总数量")
总金额 = dr.Item("总金额")
为什么出现ConnectionString 属性尚未初始化。请教各位大虾!谢谢了
我的webconfig里有
<configuration>
<appSettings/>
<connectionStrings>
<add name="dingxiConnectionString" connectionString="Data Source=5288005ac55345f.;Initial Catalog=dingxi;User ID=sa"
providerName="System.Data.SqlClient" />
</connectionStrings> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询