不能在asp.net中使用insert语句

问题描述 投票:0回答:1

请有人告诉我。我试图在DB中进行一些错误登录。我正在编写以下查询以将数据插入到仅具有2个文件名的表中。但我得到的错误是:

从第1行开始出错:命令中为1 -

INSERT INTO QISWEBLOG (DATETIME, MESSAGE) VALUES (
    '2017/12/24 01:01:48',
    Status ='0' INSPECTOPERATOR = '122018  ' INSPECTDATETIME = [20171201040930] MANAGEOPERATOR = [MIS] MANAGEDATETIME = [20171224130133] [StockGumUpdate Barcode] = [21T399--A02 BU60212CTBSID0]
)

命令行出错:4列:8 错误报告 - SQL错误:ORA-00917:缺少逗号 00917. 00000 - “缺少逗号” *原因: *行动:

我的查询是:

Dim text1 As String
text1 = "Status = '" & status & "' INSPECTOPERATOR = '" & inspectOperator & "' INSPECTDATETIME = '" & inspectDateTime & "' MANAGEOPERATOR = '" & manageOperator & "' MANAGEDATETIME = '" & manageDateTime & "' [StockGumUpdate Barcode] = '" & GridView1.Rows(index).Cells(1).Text & "'"
sqlStr = "INSERT INTO QISWEBLOG (DATETIME, MESSAGE)"
sqlStr = sqlStr & " VALUES ('" & Trim(CStr(Format(DateTime.Now, 
    "yyyy/MM/dd hh:mm:ss"))) & "','" & text1 & "')"

请帮我错。

asp.net insert
1个回答
0
投票

您需要跳过(或转义)text1变量中的所有单引号。要逃避单引号,您需要输入两次。

Status =''0''等...

© www.soinside.com 2019 - 2024. All rights reserved.