This topic is locked

Database File Problem

8/4/2006 6:48:44 PM
ASPRunner.NET General questions
P
paul.speck author

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

Eugene 8/7/2006

Please, recreate you project and this error should disappear
as for there is no error in template:
If rbtDeletefld##SHORTFIELDNAME##.Checked Then

cmd.Parameters.Add("##PARAM_NAME##", ##FIELDTYPE##).Value = DBNull.Value

cmd.Parameters.Add("##FILE_NAME_FIELD_PARAM##", ##FILE_NAME_FIELDTYPE##).Value = DBNull.Value

Else

If rbtUpdatefld##SHORTFIELDNAME##.Checked And Uploadfld##SHORTFIELDNAME##.PostedFile.ContentLength > 0 Then

cmd.Parameters.Add("##PARAM_NAME##", ##FIELDTYPE##).Value = func.GetBinary(Uploadfld##SHORTFIELDNAME##)

cmd.Parameters.Add("##FILE_NAME_FIELD_PARAM##", ##FILE_NAME_FIELDTYPE##).Value = func.TypeCast("##FILE_NAME_FIELD##", fld##SHORTFIELDNAME##.Text, "##FILE_NAME_FIELDTYPE##")

Else

sSQLUpdate = sSQLUpdate.Replace(", ##LWRAPPER####FIELD####RWRAPPER##=##PARAM_NAME##", "")

sSQLUpdate = sSQLUpdate.Replace(", ##LWRAPPER####FILE_NAME_FIELD####RWRAPPER##=##SQLPREFIX####FILE_NAME_FIELD##", "")

End If

End If

P
paul.speck author 8/7/2006

Eugene,
Thank you for the response. Rebuilding did not eliminate the error and the template looks correct. Can I send you a copy of the project file to take a quick look at? If so, what is the address? config and config_file_name are varbinary and nvarchar fields respectively in my SQL Server 2000 database.
Thanks for the help,

Paul

Eugene 8/8/2006

Yes, of course.

Please zip and send me the whole content of ASPRunner.NET output folder along with the project file and database backup on support@xlinesoft.com. I'll find what's wrong running it on my test box.

P
paul.speck author 8/9/2006

Eugene,
I sent you the project file and generated output to support@xlinesoft.com. Thanks for taking a look.
Paul Speck