开发者

The column name CATALOGNO is not valid. SQL server exception

I have a JAVA method that executes the followi开发者_运维知识库ng query to SQL server database

SELECT  [CHEMICAL_NAME],
        [CHEMI_UNIT],
        [PRICE],
        [VENDOR],
        [CATEGORY]
FROM [RPS].[dbo].[Chemicals]
WHERE CATALOGNO = '" + catNo+"' ;";

Following are the column names of the database table

CATALOGNO,
CAS_NO,
CHEMICAL_NAME,
CHEMI_UNIT,
PRICE,
VENDOR,
CATEGORY,

I get the above mentioned error

com.microsoft.sqlserver.jdbc.SQLServerException: The column name CATALOGNO is not valid.

The query by itself executes perfectly fine when I run it from SQL server query window.


try to use full-qualified column name:

SELECT [CHEMICAL_NAME],[CHEMI_UNIT],[PRICE],[VENDOR],[CATEGORY]FROM [RPS].[dbo].[Chemicals]where [RPS].[dbo].[Chemicals].[CATALOGNO] = '" + catNo+"' ;";

But I'm not sure it helps...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜