我在以下代码中收到此错误,该代码基本上会启动DROP DATABASE IF EXISTS VESSELS;
CREATE DATABASE VESSELS;
USE VESSELS;
CREATE TABLE CML (
`CML_ID` INTEGER NOT NULL,
`POF_COLUMN` VARCHAR(50),
`CML_TYPE` VARCHAR(50),
`SAMPLE_VALUE` FLOAT,
`COMPLIANCE` ENUM('YES','NO'),
`CORROSION_SEVERITY` VARCHAR(50),
`LR_LD` FLOAT,
`POF` TINYINT,
PRIMARY KEY (CML_ID)
);
CREATE TABLE POF (
`POF_COLUMN` VARCHAR(50),
`CML_TYPE` VARCHAR(50),
`VALUE_RANGE` VARCHAR(100),
`POF` TINYINT,
PRIMARY KEY (POF_COLUMN, CML_TYPE, VALUE_RANGE)
);
INSERT INTO CML
VALUES (1, 'SAMPLE_VALUE', 'MIC_SAMPLING_POINT', 5, 'NO', 'MINOR', 1, NULL),
(2, 'SAMPLE_VALUE', 'MIC_SAMPLING_POINT', 0.5, 'NO', 'MINOR', 2, NULL),
(3, 'SAMPLE_VALUE', 'MIC_SAMPLING_POINT', 20, 'NO', 'MINOR', 3, NULL),
(4, 'COMPLIANCE', 'VALVE_ROTATED', 0, 'YES', 'MINOR', 4, NULL),
(5, 'LR_LD', 'PIPING_THICKNESS', 0, 'YES', 'MINOR', 0.1, NULL),
(6, 'CORROSION_SEVERITY', 'VESSEL_SHELL', 0, 'NO', 'SEVERE', 0, NULL),
(7, 'CORROSION_SEVERITY', 'NOZZLE', 0, 'NO', 'LOW', 0, NULL);
INSERT INTO POF
VALUES ('SAMPLE_VALUE', 'MIC_SAMPLING_POINT', 1, 5),
('SAMPLE_VALUE', 'MIC_SAMPLING_POINT', 5, 4),
('SAMPLE_VALUE', 'MIC_SAMPLING_POINT', 10, 3),
('SAMPLE_VALUE', 'MIC_SAMPLING_POINT', 15, 2),
('SAMPLE_VALUE', 'MIC_SAMPLING_POINT', 100, 1),
('COMPLIANCE', 'VALVE_ROTATED', 'YES', 5),
('COMPLIANCE', 'VALVE_ROTATED', 'NO', 1),
('LR_LD', 'PIPING_THICKNESS', 2, 5),
('LR_LD', 'PIPING_THICKNESS', 1.5, 4),
('LR_LD', 'PIPING_THICKNESS', 1, 3),
('LR_LD', 'PIPING_THICKNESS', 0.8, 2),
('LR_LD', 'PIPING_THICKNESS', 0.5, 1),
('CORROSION_SEVERITY', 'VESSEL_SHELL', 'NEGLIGIBLE', 5),
('CORROSION_SEVERITY', 'VESSEL_SHELL', 'LOW', 4),
('CORROSION_SEVERITY', 'VESSEL_SHELL', 'MEDIUM', 3),
('CORROSION_SEVERITY', 'VESSEL_SHELL', 'HIGH', 2),
('CORROSION_SEVERITY', 'VESSEL_SHELL', 'SEVERE', 1),
('CORROSION_SEVERITY', 'NOZZLE', 'NEGLIGIBLE', 5),
('CORROSION_SEVERITY', 'NOZZLE', 'LOW', 5),
('CORROSION_SEVERITY', 'NOZZLE', 'MEDIUM', 5),
('CORROSION_SEVERITY', 'NOZZLE', 'HIGH', 3),
('CORROSION_SEVERITY', 'NOZZLE', 'SEVERE', 2);
-- UPDATE EXACT MATCHING VALUE
UPDATE CML c
LEFT JOIN POF p
ON c.POF_COLUMN = p.POF_COLUMN
AND c.CML_TYPE = p.CML_TYPE
AND ( (c.POF_COLUMN = 'COMPLIANCE' AND c.COMPLIANCE = p.VALUE_RANGE) OR
(c.POF_COLUMN = 'SAMPLE_VALUE' AND c.SAMPLE_VALUE = p.VALUE_RANGE) OR
(c.POF_COLUMN = 'LR_LD' AND c.LR_LD = p.VALUE_RANGE) OR
(c.POF_COLUMN = 'CORROSION_SEVERITY' AND c.CORROSION_SEVERITY = p.VALUE_RANGE)
)
SET c.POF = p.POF;
SELECT * FROM CML;
请求
POST
ABC.ascx
var ABCid = $(aTag).data('id');
$.ajax({
type: "POST",
url: "WebMethods.aspx/Delete_Local_ABC",
data: "{'id':'" + ABCid + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: successdelete_ABC,
error: Errordelete_ABC
});
}
WebMethods.aspx.cs
我在[WebMethod]
public static int Delete_Local_ABC(string id)
{
ABC objABC = new ABC();
objABC.ABC_ID = Convert.ToInt32(id);
// call business manager
try
{
BusinessManager businessManager = new BusinessManager();
businessManager.ManageABC(objABC, OperationTypes.Validate);
return 1;
}
catch (Exception ex)
{
throw ex;
}
}
BusinessManager.cs
和....
case OperationTypes.Validate:
obj.deleteLocalABC();
break;
...
ABC.cs
我尝试过在线提供的所有解决方案但没有任何效果。此代码与public bool deleteLocalABC()
{
string query = "DELETE FROM TBL_ABC WHERE ABC_ID ='" + this.ABC_ID + "'";
_dbManager.executeQuery(query);
return true;
}
完美匹配,但不适用于主要部署。
答案 0 :(得分:1)
使用
[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
而不只是[WebMethod]
。
我希望你的方法在添加之后能正常工作。