嗨,我正在使用下面的代码选择一些数据,并且在“名称”附近出现错误语法不正确。必须声明标量变量“@Provider”。有什么想法吗?谢谢!
cmd = New SqlCommand
cmd.Connection = Con
cmd.CommandText = "SELECT NPI, [Entity Type Code], [Provider Last Name (Legal Name)] FROM NPIData WHERE ([Provider Last Name (Legal Name)] LIKE @Provider Last Name (Legal Name) + '%'"
cmd.Parameters.AddWithValue("@Provider", prefixText)
Dim customers As List(Of String) = New List(Of String)
Dim reader As SqlDataReader = cmd.ExecuteReader()
While reader.Read
customers.Add(reader("@Provider").ToString)
End While
Con.Close()
Return customers.ToArray