Hello,
I am trying to add a database file upload field and am running into some issues. I have two fields, a text field for the file name, and database file field for the actual file. Named 'config_file_name' and 'config' respectively. When I attempt to upload a file i get the following error:
Error description: The variable name '@config' has already been declared. Variable names must be unique within a query batch or stored procedure. Must declare the variable '@config_file_name'.
When looking at the code that was generated for this page, I noticed the following:
If rbtDeletefldconfig.Checked Then
cmd.Parameters.Add("@config", SqlDbType.Variant).Value = DBNull.Value
cmd.Parameters.Add("@config", SqlDbType.NVarChar).Value = DBNull.Value
Else
If rbtUpdatefldconfig.Checked And Uploadfldconfig.PostedFile.ContentLength > 0 Then
cmd.Parameters.Add("@config", SqlDbType.Variant).Value = func.GetBinary(Uploadfldconfig)
cmd.Parameters.Add("@config", SqlDbType.NVarChar).Value = func.TypeCast("config_file_name", fldconfig.Text, "SqlDbType.NVarChar")
Else
sSQLUpdate = sSQLUpdate.Replace(", [config]=@config", "")
sSQLUpdate = sSQLUpdate.Replace(", [config_file_name]=@config_file_name", "")
End If
End If
It appears that @config is being used twice while @config_file_name is left out on several parts. If anyone has any insight on what might be the problem here I would appreciate the help. I can provide any more information if needed.
Thank you,
Paul