1

好吧,这可能会非常明显,但是在查看相同的代码块 3 天后,我开始对它失去理智。

下面2个代码块。第一个像魅力一样工作,但第二个虽然我认为它的编码正确,但一直给我带来问题。

SQL = "EXECUTE sp_AddEvent '" &_
chrEventName & "','" &_
chrEventManager & "','" &_
chrEventAssistant & "','" &_
txtEventDescr & "','" &_
intEventTypeID & "'," &_
intEventCatagoryID & "," &_
intIncomeModelID & "," &_
intEventStatusID & ",'" &_
dtEventStart & "','" &_
dtEventEnd & "','" &_
intMultiArea & "'," &_
intMultiLokation & "," &_
intMultiDay & ",'" &_
dtEventAdded & "','" &_
dtEventChanged & "','" &_
intEventLastChangedBy & "'"

'   Executing Insert statement.
SET rsAddEvent = someconnection.EXECUTE(SQL)

现在是第二块让我现在完全发疯了。

SQL = "EXECUTE sp_AddLokation '" &_
chrLokationName & "','" &_
chrLokationStreet & "','" &_
chrLokationCity & "','" &_
chrLokationCountry & "','" &_
chrLokationSNumber & "','" &_
chrLocationZipcode & "','" &_
chrLokationPhone & "','" &_
chrLokationFax & "','" &_
chrLokationEmail & "','" &_
chrLokationWebsite & "','" &_
intLokationTypeID & "'," &_
intMultiArea & "," &_
intLokationStatusID & ",'" &_
dtLokationAdded & "','" &_
dtLokationChanged & "','" &_
intLastChangedBy & "'"

'   Executing Insert statement.
SET rsAddLokation = someconnection.EXECUTE(SQL)

被调用来插入数据的存储过程工作正常,所以它必须是 ASP 级别的东西。

在我开始咀嚼键盘之前,有人对这种怪异有什么建议吗?

另外:我要么得到一个 varchar 到 int 的转换错误,要么在 dtlokationAdded 之前的最后 3 个 int 字段之一中摆弄 ' 时我得到一个语法错误附近(取决于通过摆弄受影响的字段)

4

3 回答 3

1

假设所有以数字开头的字段int都是数字(除了intLastChangedBy,在前一个块中用引号括起来;如果是,也删除该引号):

SQL = "EXECUTE sp_AddLokation '" &_
chrLokationName & "','" &_
chrLokationStreet & "','" &_
chrLokationCity & "','" &_
chrLokationCountry & "','" &_
chrLokationSNumber & "','" &_
chrLocationZipcode & "','" &_
chrLokationPhone & "','" &_
chrLokationFax & "','" &_
chrLokationEmail & "','" &_
chrLokationWebsite & "'," &_
intLokationTypeID & "," &_
intMultiArea & "," &_
intLokationStatusID & ",'" &_
dtLokationAdded & "','" &_
dtLokationChanged & "','" &_
intLastChangedBy & "'"
于 2012-11-30T06:46:40.660 回答
0

Ok, thanks all for trying to help me out here!

It seems my issue is resolved. It must be code-midgets who payed me a visit last night. Other than that i can't explain what just happened. Cause when i left the project yesterday it sure as hell wasn't working at all.

于 2012-12-01T10:41:03.773 回答
0
intLokationTypeID & "'," &_

好吧,我注意到这里有一组引号,但只有一个撇号……这可能会导致错误?或者,等等,我想我知道你把它关在哪里了。(几行下来,对不起!)

于 2012-11-29T19:57:06.770 回答