0
devサーバーからライブサーバーにコードを転送する際に問題が発生しました。BC30068:式は値であるため、割り当ての対象にすることはできません
それはライブでのDevで働いていないが...
エラーがここに発生します。
personList.Add(New Person() With {.ID = reader("user_id"), .Name = reader("person")})
をし、エラーメッセージは次のとおりです。式は、値であるため、割り当ての対象になりません。背後
コード:
Public Class Person
Private m_ID As Integer
Public Property ID() As Integer
Get
Return m_ID
End Get
Set(ByVal value As Integer)
m_ID = value
End Set
End Property
Private m_Name As String
Public Property Name() As String
Get
Return m_Name
End Get
Set(ByVal value As String)
m_Name = value
End Set
End Property
Public Sub New()
End Sub
Public Function GetPersonList(ByVal tryvalue As String, ByVal is_cust As Integer) As List(Of Person)
Dim personList As New List(Of Person)()
Dim sqlCommand As New SqlCommand()
Dim connectionString As String = ConfigurationManager.ConnectionStrings("scConnString").ConnectionString
Dim command As New SqlCommand
Dim reader As SqlDataReader
Dim org_id = HttpContext.Current.Session("org_id")
Dim strName As String = ""
Dim nID As Integer = 0
Dim loadNameSQL As String = "SELECT distinct top 10 user_id, firstname + ' ' + lastname as person FROM users WHERE " & _
"firstname + ' ' + lastname like @tryvalue and org_id = @org_id and delete_flag=0"
sqlCommand.Parameters.AddWithValue("tryValue", tryvalue + "%")
sqlCommand.Parameters.AddWithValue("org_id", org_id)
Dim sqlConnection As New SqlConnection(connectionString)
Try
sqlConnection.Open()
sqlCommand.CommandText = loadNameSQL
sqlCommand.Connection = sqlConnection
reader = sqlCommand.ExecuteReader()
Do While reader.Read()
personList.Add(New Person() With {.ID = reader("user_id"), .Name = reader("person")})
Loop
reader.Close()
Catch ex As Exception
Finally
sqlConnection.Close()
End Try
Return personList
End Function
エンドクラス
任意のアイデア?
おかげで、