Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 从web表单更新MySQL字段wilth NULL_Html_Mysql_Asp Classic - Fatal编程技术网

Html 从web表单更新MySQL字段wilth NULL

Html 从web表单更新MySQL字段wilth NULL,html,mysql,asp-classic,Html,Mysql,Asp Classic,我在(经典)ASP网页上有一个表单,我想用它删除记录字段中的数据。字段本身的默认值为NULL 我试过几种方法来做到这一点。如果我使用,它会插入一个空格。如果我使用,它会插入单词NULL,但这不是NULL值 有什么想法吗 SQL(来自Dreamweaver): 节内的: Set MM_editCmd = Server.CreateObject ("ADODB.Command") MM_editCmd.ActiveConnection = MM_ENG_STRING MM_editCmd.Comma

我在(经典)ASP网页上有一个表单,我想用它删除记录字段中的数据。字段本身的默认值为NULL

我试过几种方法来做到这一点。如果我使用
,它会插入一个空格。如果我使用
,它会插入单词NULL,但这不是NULL值

有什么想法吗

SQL(来自Dreamweaver):

节内的

Set MM_editCmd = Server.CreateObject ("ADODB.Command")
MM_editCmd.ActiveConnection = MM_ENG_STRING
MM_editCmd.CommandText = "UPDATE tblContent SET ContentImage = ?, ContentImageCaption = ? WHERE ContentID = ?" 
MM_editCmd.Prepared = true
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("ContentImage")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 105, Request.Form("ContentImageCaption")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 5, 1, -1, MM_IIF(Request.Form("MM_recordId"), Request.Form("MM_recordId"), null)) ' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
我更改了关于数据库更新的行,从

MM_editCmd.CommandText = "UPDATE tblContent SET ContentImage = ?, ContentImageCaption = ? WHERE ContentID = ?"

然后删除了(在本例中为两行)表示字段为空的行

MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("ContentImage")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 105, Request.Form("ContentImageCaption")) ' adVarWChar

提交表单时,在必填字段中输入NULL。表单详细信息保持不变。

代码添加到原始帖子中。感谢Nathan的链接。我试了几次才让它工作,但现在一切都好了。绝妙的!很高兴听到!很乐意提供帮助。@MartySmartyPants您能否将更新后的代码作为答案发布,并接受它以帮助遇到此问题的其他人?具有不出现在未应答队列中的额外好处-请参阅
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 255, Request.Form("ContentImage")) ' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 202, 1, 105, Request.Form("ContentImageCaption")) ' adVarWChar