Pregunta

I am new to scala language, i am using anorm to insert data into DB, please give an example to insert data into my table userTable

Table : userId, userName

Thanks

¿Fue útil?

Solución

Try this code.. accept answer if it solves your problem.

DB.withConnection { implicit c =>
  SQL("INSERT INTO userTable values({userId},{userName})").on("userId" -> "User's id", "userName" -> "your_name").executeInsert();
}

Otros consejos

DB.withConnection { implicit c =>
SQL("insert into userTable values({userId},{userName})").on("userId" -> value1, "userName" -> value2).executeInsert();
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top