Insert into db, Object Required String

后端 未结 2 1602
粉色の甜心
粉色の甜心 2021-01-29 06:48

I need to insert some data into DB, there is a problem..it gives me an error :

Source line:

SET sql =\"Insert In         


        
2条回答
  •  一个人的身影
    2021-01-29 07:45

    In VBScript, VBA and VB5/6, SET is required to assign an object reference; to assign any other sort of data (including a string), just remove it:

    sql = "Insert Into Products (ProductName,SupID,CatID,Price,Pic,Description) Values( '"&pName&"','"&pbId&"','"&pcId&"','"&price&"','"&pic&"','"&desc&"')" 
    

    (In VBA and VB5/6 you could also use LET here.)

    The reason SET works when assigning the result of a Request.Form("foo") call is because the Form collection is a collection of objects - the subsequent tests against "" and "-1" are valid only because the objects returned have a default parameterless property or method that return a string-compatible variant.

提交回复
热议问题