我正在使用Java和MySQL,我必须从DB中选择如下内容:
String sql = "SELECT type FROM test_case where input=" + inputTestCase;
问题是,inputTestCase字符串有时会有换行。在这些情况下,我得到了一个例外,例如:
You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version
for the right syntax to use near '5
8
我希望允许用户搜索特定的日期(使用文本框),并允许数据库显示该日期内输入的所有信息。我已经编译了查询,如下所示:
SELECT Date, ([Test result]),
FROM [User/Test]
WHERE Date Like '%' + @value + '%'
我在手机上使用了数据网格视图,让用户可以直观地看到搜索结果,加入了一个文本框和搜索按钮,并在这个按钮后面使用了下面的代码:
this.user_TestTableAdapter.search(this.questionareDataS