This is a migrated thread and some comments may be shown as answers.

Delete raise error

1 Answer 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lakmal
Top achievements
Rank 2
lakmal asked on 04 Sep 2009, 05:05 PM
Hi,

When i goto delete record this error is raising why that?

Incorrect syntax near '?'.


this is my grid and datasource
 <telerik:RadGrid ID="RadGrid5" runat="server" AutoGenerateColumns="False"  AllowAutomaticInserts="True"
                                AllowAutomaticUpdates="True" AllowAutomaticDeletes="false"
                                        GridLines="None" DataSourceID="SqlDataSource2" Width="400px"
                                AllowSorting="True" Skin="Web20" >
                                <MasterTableView AutoGenerateColumns="False" DataKeyNames="DocNo" CommandItemDisplay="TopAndBottom"
                                 AllowAutomaticDeletes="true" AllowAutomaticInserts="true" >
                                
                                    <Columns>
                                                                             
                                        <telerik:GridBoundColumn DataField="DocNo" HeaderText="Doc No" Visible="false" ReadOnly="true"
                                            UniqueName="DocNo">
                                        </telerik:GridBoundColumn>
                                        
                                      <telerik:GridTemplateColumn UniqueName="IDCcomID" HeaderText="Doc Own AppComment">                                        
                                        <ItemTemplate>                                        
                                         <telerik:RadComboBox runat="server"
                                             ID="RadComp"
                                             DataTextField="DocOwnAppComment"
                                             DataValueField="DocOACID"
                                             HighlightTemplatedItems="true"
                                             Height="190px"
                                             Width="220px"
                                             DropDownWidth="420px"
                                                DataSourceID="ContactsDataSource"
                                                SelectedValue='<%#Bind("IDCcomID") %>'></telerik:RadComboBox>                                        
                                        </ItemTemplate>
                                        <EditItemTemplate>                                        
                                        <telerik:RadComboBox runat="server"
                                             ID="RadCompEdit"
                                             DataTextField="DocOwnAppComment"
                                             DataValueField="DocOACID"
                                             HighlightTemplatedItems="true"
                                             Height="190px"
                                             Width="220px"
                                             DropDownWidth="420px"
                                                DataSourceID="ContactsDataSource"
                                                SelectedValue='<%#Bind("IDCcomID") %>'></telerik:RadComboBox>                                                
                                        
                                        </EditItemTemplate>                                        
                                        </telerik:GridTemplateColumn>                                
                                        
                                        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="Are you sure delete this record?"
                                            Text="Delete" UniqueName="column">
                                        </telerik:GridButtonColumn>
                                       </Columns>
                                    
                                </MasterTableView>
                              </telerik:RadGrid>


 <asp:SqlDataSource ID="SqlDataSource2"
                                    ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>"
                                    SelectCommand="SELECT DocNo , [IDCcomID] FROM [tbl_DATA_IDCcomment] WHERE (DocNo = @DocNo)"
                                    DeleteCommand= "delete from  tbl_DATA_IDCcomment where DocNo = @DocNo and IDCcomID=?"
                                     runat="server">
                                   
                                  <SelectParameters>                                                                           
                                        <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="DocNo" />
                                    </SelectParameters>
                                     <DeleteParameters>
                                      <asp:Parameter Name="IDCcomID" Type="Int32" />
                                     
                                     </DeleteParameters>  
                                </asp:SqlDataSource>





1 Answer, 1 is accepted

Sort by
0
lakmal
Top achievements
Rank 2
answered on 06 Sep 2009, 05:32 PM
I found solution

ClientDataKeyNames  is the solution
Tags
Grid
Asked by
lakmal
Top achievements
Rank 2
Answers by
lakmal
Top achievements
Rank 2
Share this question
or