Forums

This topic is locked

DataGrid Update Error

Posted 17 Nov 2003 20:48:26
1
has voted
17 Nov 2003 20:48:26 Ken trimmer posted:
I've created a datagrid in DWMX with an edit update and cancel column.
Everything works fine except when I click update. I get this error.

System.Data.SqlClient.SqlException: The variable name '@Product_Types' has already been declared. Variable names must be unique within a query batch or stored procedure.
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at DreamweaverCtrls.DataSet.OnDataGridUpdate(Object Src, DataGridCommandEventArgs E)

I can't seem to find an answer anywhere

Replies

Replied 22 Nov 2003 06:11:18
22 Nov 2003 06:11:18 Nozomi Kugita replied:
My guess would be that you are updating multiple columns of a record and you might have selcted product_types to update by multiple values. In other words, you may have selected the variable name "Product_Type" for a different field within the same form.

- Noz
Replied 24 Nov 2003 14:52:16
24 Nov 2003 14:52:16 Ken trimmer replied:
Acctually, I have found the problem, It appears as though dreamweaver does not like to update the Primary Key. So, what I ended up doing is creating another field in my Database. Setting it to autoIncrement and making it the primary key then the update works fine.

Reply to this topic