【发布时间】:2011-12-23 12:08:23
【问题描述】:
我在我的数据库中存储一个文件路径:
selecteddestinationfilepath = selectedPfile.getPath();
.
.
.
state.execute("INSERT INTO "+tablename+" (filename,filepath) VALUES ('"+theselecteddestinationname+"','"+theselecteddestinationfilepath+"')");
但是当它存储到数据库中时,它会丢弃所有的“\”
所以而不是D:\Programs\Rynmag181 -TFC
它的D:ProgramsRynmag181 -TFC
我该如何解决这个问题?
【问题讨论】:
-
你的字符串中的斜杠是否被转义了?
-
尽管您仍然需要解决问题,但您知道即使在 Windows 上也可以使用正斜杠吗?
标签: java mysql file netbeans insert