这行中有什么错误?我得到的错误是缺少双引号.我无法解决它请给我适当的代码 [英] What is the error in this lines?I am getting the error as missing double quote.I couldn't solve it pls reply me the appropriate code
本文介绍了这行中有什么错误?我得到的错误是缺少双引号.我无法解决它请给我适当的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<%
Class.forName("com.ibm.db2.jcc.DB2Driver");
System.out.println("driver loaded sucesssssssssssssssssss");
Connection
Conn=DriverManager.getConnection("jdbc:db2://localhost:50000/VOTERS","db2admin","friends");
String Login_name=request.getParameter("Login Id");
String Password_id=request.getParameter("Password");
PreparedStatement Stmt=Conn.prepareStatement("SELECT NAME FROM
LOGIN_DETAILS WHERE LOGIN ID='"+Login_name+"' AND PASSWORD='"+Password_id+"'");
System.out.println("Statement loaded sucesssssssssssssssssss");
Stmt.executeQuery();
ResultSet rs=Stmt.getResultSet();
System.out.println("query execute loaded sucesssssssssssssssssss");
String name= null;
while(rs.next())
{ Login=rs.getString(1);
}
rs.close();Stmt.close();Conn.close();
if(name != null)
out.println("Welcome to "+login);
else
out.println("Please check your Login Id and Password...");
%>
推荐答案
只是一个猜测:这实际上是两行吗?
Just a guess: Are these actually two lines as they seem?
PreparedStatement Stmt=Conn.prepareStatement("SELECT NAME FROM
LOGIN_DETAILS WHERE LOGIN ID=''"+Login_name+"'' AND PASSWORD=''"+Password_id+"''");
因为如果是这样,请尝试使它们成为一行.
Because if they are, try making them a single line.
根据我上面的评论,我在网上做了一些挖掘工作;
关于包含空格的列名/表名以及处理它们的几种不同方式,有很多事情.
最常见的方法是使用方括号[]
,例如;
Select [some col] from theTable where [another col]=''xyz''
您还可以使用反斜杠`
(不同于单引号''
),例如;
Select `some col` from theTable where `another col`=''xyz''
我的首选仍然是放弃设计中的空间,但是如果您不能尝试其中的一种.
As per my comment above, i have jut done some digging on the net;
There are various things regarding column names / table names containing spaces, and the several different ways of handling them.
The most common methods are using the square brackets[]
e.g.;
Select [some col] from theTable where [another col]=''xyz''
You can also use a back tick`
(different from a single quote''
) e.g.;
Select `some col` from theTable where `another col`=''xyz''
My preference would still be to ditch the space in the design, but if you can''t then try one of those.
这篇关于这行中有什么错误?我得到的错误是缺少双引号.我无法解决它请给我适当的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文