我想更新特定表的行值,但不知道该怎么做。
结构如何:
db: 工作: 作业(我要从参数中选择作业ID相同的地方)
export async function UpdateJobDetails(data) {
const query = `
UPDATE
job
SET
Company = ?,
SubBuilding = ?,
BuildingName = ?,
BuildingNumber = ?,
PrimaryStreet = ?,
SecondaryStreet = ?,
Town = ?,
County = ?,
Postcode = ?
FROM
db_jobs
WHERE
db_jobs.jobID = ?
`
return new Promise(resolve => {
let forms = []
db.transaction((tx) => {
tx.executeSql(query, [data.Company, data.SubBuilding, data.BuildingName, data.BuildingNumber, data.PrimaryStreet, data.SecondaryStreet, data.Town, data.County, data.Postcode, data.dataJobID], (tx, results) => {
resolve(forms)
})
})
})
}
我知道上面的代码不好,我只是认为它有助于理解我的问题。
答案 0 :(得分:0)
您的UPDATE
语句的语法错误。
去掉
语句中的FROM db_jobs
。应该是UPDATE <table name> SET ...
将<table name>
替换为实际的表名。