未定义的函数'concat' vb.net [重复]
Posted
技术标签:
【中文标题】未定义的函数\'concat\' vb.net [重复]【英文标题】:undefined function 'concat' vb.net [duplicate]未定义的函数'concat' vb.net [重复] 【发布时间】:2018-02-24 17:42:49 【问题描述】:我在连接我的 sql 中的 2 列时遇到问题。有人可以检查我的 concat 语句中出了什么问题。
查询:
Public Function getStudents(ByVal oStudentsBO As StudentsBO) As DataTable
dt = New DataTable
sql = "SELECT [KY_ID_NUM] as [ID Num], [NM_NICK] as [Nick Name], [CD_AGE_GROUP] as [Age Group], " &
"[NM_LAST] as [Last Name], [NM_FIRST] as [First Name], " &
"CONCAT(NM_GFIRST, NM_GLAST) FROM [tblStudents] " &
"WHERE [NM_FIRST] Like '%" & oStudentsBO.NM_FIRST & "%'" &
"OR [NM_NICK] LIKE '%" & oStudentsBO.NM_NICK & "%'" &
"OR [NM_LAST] Like '%" & oStudentsBO.NM_LAST & "%'"
dt = oDA.getDataTable(sql)
Return dt
End Function
错误:
【问题讨论】:
您使用的是哪个 DBMS 和版本?请复制并粘贴您的代码为文本 什么是下划线数据库? 下划线数据库是什么意思? Oracle(哪个版本10g、11g、12g)、mysql(哪个版本)、SQLServer等。我从查询中猜是SQLServer。 MS 访问没有 CONCAT 函数。使用字符串连接。 【参考方案1】:MS Access 没有函数 CONCAT。相反,您必须使用字符串连接:
Public Function getStudents(ByVal oStudentsBO As StudentsBO) As DataTable
dt = New DataTable
sql = "SELECT [KY_ID_NUM] as [ID Num], [NM_NICK] as [Nick Name], [CD_AGE_GROUP] as [Age Group], " &
"[NM_LAST] as [Last Name], [NM_FIRST] as [First Name], " &
" [NM_GFIRST] & [NM_GLAST] FROM [tblStudents] " &
"WHERE [NM_FIRST] Like '%" & oStudentsBO.NM_FIRST & "%'" &
"OR [NM_NICK] LIKE '%" & oStudentsBO.NM_NICK & "%'" &
"OR [NM_LAST] Like '%" & oStudentsBO.NM_LAST & "%'"
dt = oDA.getDataTable(sql)
Return dt
End Function
【讨论】:
以上是关于未定义的函数'concat' vb.net [重复]的主要内容,如果未能解决你的问题,请参考以下文章