문제

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

도움이 되었습니까?

해결책

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();
}

다른 팁

DB.withConnection { implicit c =>
SQL("insert into userTable values({userId},{userName})").on("userId" -> value1, "userName" -> value2).executeInsert();
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top