我正在学习使用mysql数据库,现在尝试用文本字段中的文本填充语句。 程序是电话簿,字符串是名称,姓氏和电话号码,必须在文本字段中写入,然后将其添加到要导入数据库的语句中。 所以,现在我有了这个,但是却无法正常工作,因为语句甚至都没有将字符串识别为值。
if("Potvrdi".equals(buttonLabel)) {
String ime = a.getText();
String prezime = b.getText();
String broj = c.getText();
Connection conn = dc.connect();
Statement st = (Statement) conn.createStatement();
st.executeUpdate("INSERT INTO imenik VALUES (ime,prezime,broj)");
conn.close();
}
答案 0 :(得分:2)
使用prepare语句,
@section BottomScripts {
@if (Model.NeedThisScript)
{
await Html.RenderPartialAsync("PartialWithYourScripts");
}
}