Mata

Mata

  • NA
  • 46
  • 34.5k

SOLVED : Binding decimal data Update command Gridview problem

Dec 13 2011 9:07 AM
Don't know in what section this question goes but here I go.

I'm getting Truncated incorrect DOUBLE value:'20,12' error (this is value I had  in edittamplate textbox of gridview, not the new updated value in textbox in edittamplate ).
I'm using mySQL database. I get this error everytime I put some value ( I think decimal data is problem generally to this to work) in textbox and than push Update button of a gridview to trigger Update command. I think whole process about Updating decimal values and binding decimal data to textbox is the problem. It is funny that insert of new records (with decimal values) work ok. So maybe who knows mysql and asp.net can help me with this. Maybe there are some restrictions. thx

Binding is done like this:

<asp:TemplateField HeaderText="Cijena" SortExpression="cijena">
                                <ItemTemplate>
                                    <asp:Label ID="lbcijenaDostave" runat="server" Text='<%# Bind("cijena") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="tbcijenaDostave" runat="server" Text='<%# Bind("cijena") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <FooterTemplate>
                                    <asp:TextBox ID="tbcijenaDostaveFoot" runat="server" Visible="false"></asp:TextBox>
                                </FooterTemplate>
                            </asp:TemplateField>



SQL DATA SOURCE PART
<asp:SqlDataSource ID="SQLLocal2" runat="server" ConnectionString="<%$ ConnectionStrings:dbSQL %>" OldValuesParameterFormatString="old_{0}" ConflictDetection="CompareAllValues"
                        ProviderName="<%$ ConnectionStrings:dbSQL.ProviderName %>" 
                        SelectCommand="SELECT id_dostave, naziv, cijena FROM nacin_dostave"
                        UpdateCommand="UPDATE nacin_dostave SET naziv=@naziv, cijena=@cijena WHERE id_dostave=@old_id_dostave AND naziv=@old_naziv AND cijena=@old_cijena"
                        DeleteCommand="DELETE FROM nacin_dostave WHERE id_dostave=@old_id_dostave"
                        InsertCommand="INSERT INTO nacin_dostave (naziv,cijena) VALUES (@naziv,@cijena)">
                        <UpdateParameters>
                        <asp:Parameter Name="naziv" />
                        <asp:Parameter Name="cijena" DbType="Decimal" />
                        </UpdateParameters>
                        <InsertParameters>
                        <asp:Parameter Name="naziv" />
                        <asp:Parameter Name="cijena" DbType="Decimal" />
                        </InsertParameters>
                    </asp:SqlDataSource>



Answers (1)