problems with SELECT statement for updates

P

paul.mcmanus.uk

Hi all,

I'm using a datagrid to display and update information from several
tables in SQL Server.

I've created my SQL SELECT statement with the necessary INNER JOINs and
this works correctly when displaying the data but for some reason when
i edit one of the rows two copies of each row are displayed.

my SELECT statement is as follows:

SELECT imgSubjJUNCTid, imageID, kw_subject_lv1.subjectLv1_desc,
kw_subject_lv2.subjectLv2_desc FROM junct_subject INNER JOIN
kw_subject_lv1 ON junct_subject.subj_Lv1_ID =
kw_subject_lv1.subjectLv1_ID INNER JOIN kw_subject_lv2 ON
junct_subject.subj_Lv2_ID = kw_subject_lv2.subjectLv2_ID WHERE
junct_subject.imageID = "+imgID

my datagrid code is:

<asp:DataGrid ID="dgSubjects" runat="server"
AutoGenerateColumns="false" OnEditCommand="dg_edit"
OnCancelCommand="dg_cancel" OnUpdateCommand="dg_update"
ShowHeader="false">
<Columns>

<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "imgSubjJUNCTid") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="imgSubjJunct_ID" Text='<%#
DataBinder.Eval(Container.DataItem, "imgSubjJUNCTid") %>'
runat="server" />
</EditItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "subjectLv1_desc") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddl_subject1" runat="server" DataSource='<%#
getSubjectLv1() %>' DataTextField="subjectLv1_desc"
DataValueField="subjectLv1_ID" OnSelectedIndexChanged='subjectFilter'
/>
</EditItemTemplate>
</asp:TemplateColumn>

<asp:TemplateColumn>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "subjectLv2_desc") %>
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="ddl_subject2" runat="server" DataSource='<%#
getSubjectLv2() %>' DataTextField="subjectLv2_desc"
DataValueField="subjectLv2_ID" />
</EditItemTemplate>
</asp:TemplateColumn>

<asp:EditCommandColumn EditText="Edit" UpdateText="OK"
CancelText="Cancel"/>

</Columns>
</asp:DataGrid>



does anyone have any experience of a similar problem,

any ideas would be appreciated, thanks in advance

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top