2
我試圖在apple_reportDB
插入一些數據參數太多,但我得到的錯誤爲Too many arguments for method in the insert query
顯示方法
import scala.slick.driver.MysqlDriver.simple._
case class AppleReport(quantity:String,price:String,sale_amount:String)
//tables
class Suppliers(tag: Tag)
extends Table[AppleReport](tag, "apple_report") {
def quantity=column[String]("quantity")
def price=column[String]("price")
def sale_amount=column[String]("sale_amount")
def * =(quantity,price,sale_amount) <> (AffiliateReportFields.tupled,AffiliateReportFields.unapply)
}
//declaring interface
val suppliers: TableQuery[Suppliers] = TableQuery[Suppliers]
val db=Database.forURL("jdbc:mysql://localhost:3306/apple_reportDB","root","",null, driver="com.mysql.jdbc.Driver")
db.withSession { implicit session =>
//create table
suppliers.ddl.create
//Insert data
suppliers += ("apple","cow","cat")
}