none
Gridwiev de Id ye göre başka bir tablodan İsim çekilebilirmi? RRS feed

  • Soru

  • Merhaba

    Verileri gridvievle virsualstudio da otomatik çekip listele ve düzenle sil yapıyorum. Lakin Id çekiyor ben id değilde diğer tablodan o id deki ismi göstersin istiyorum. bu mümkünmüdür?

    Nasıl yapabilirim?

    Kodlarım

    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
                        DataKeyNames="OgrenciSertifikaID" DataSourceID="SqlDataSource5" ForeColor="#333333" 
                        GridLines="None" Width="100%">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <Columns>
                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                                ShowSelectButton="True" />
                            <asp:BoundField HeaderStyle-HorizontalAlign="Left" DataField="OgrenciSertifikaID" 
                                HeaderText="OgrenciSertifikaID" SortExpression="OgrenciSertifikaID" 
                                InsertVisible="False" ReadOnly="True" >
    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                            </asp:BoundField>
                            <asp:BoundField HeaderStyle-HorizontalAlign="Left" DataField="SertifikaID" HeaderText="SertifikaID" 
                                SortExpression="SertifikaID" >
    <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
                            </asp:BoundField>
                             <asp:BoundField DataField="SertifikaNotu" HeaderText="SertifikaNotu" 
                                SortExpression="SertifikaNotu" />
                            <asp:BoundField DataField="Tarih" HeaderText="Tarih" SortExpression="Tarih" />
                            <asp:BoundField DataField="OgrenciID" HeaderText="OgrenciID" 
                                SortExpression="OgrenciID" />
                        </Columns>
                        <EditRowStyle BackColor="#999999" />
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                    </asp:GridView>
                    <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
                        ConflictDetection="CompareAllValues" 
                        ConnectionString="<%$ ConnectionStrings:ebruConnectionString8 %>" 
                        DeleteCommand="DELETE FROM [OgrenciSertfika] WHERE [OgrenciSertifikaID] = @original_OgrenciSertifikaID AND (([SertifikaID] = @original_SertifikaID) OR ([SertifikaID] IS NULL AND @original_SertifikaID IS NULL)) AND (([SertifikaNotu] = @original_SertifikaNotu) OR ([SertifikaNotu] IS NULL AND @original_SertifikaNotu IS NULL)) AND (([Tarih] = @original_Tarih) OR ([Tarih] IS NULL AND @original_Tarih IS NULL)) AND (([OgrenciID] = @original_OgrenciID) OR ([OgrenciID] IS NULL AND @original_OgrenciID IS NULL))" 
                        InsertCommand="INSERT INTO [OgrenciSertfika] ([SertifikaID], [SertifikaNotu], [Tarih], [OgrenciID]) VALUES (@SertifikaID, @SertifikaNotu, @Tarih, @OgrenciID)" 
                        OldValuesParameterFormatString="original_{0}" 
                        SelectCommand="SELECT * FROM [OgrenciSertfika]" 
                        UpdateCommand="UPDATE [OgrenciSertfika] SET [SertifikaID] = @SertifikaID, [SertifikaNotu] = @SertifikaNotu, [Tarih] = @Tarih, [OgrenciID] = @OgrenciID WHERE [OgrenciSertifikaID] = @original_OgrenciSertifikaID AND (([SertifikaID] = @original_SertifikaID) OR ([SertifikaID] IS NULL AND @original_SertifikaID IS NULL)) AND (([SertifikaNotu] = @original_SertifikaNotu) OR ([SertifikaNotu] IS NULL AND @original_SertifikaNotu IS NULL)) AND (([Tarih] = @original_Tarih) OR ([Tarih] IS NULL AND @original_Tarih IS NULL)) AND (([OgrenciID] = @original_OgrenciID) OR ([OgrenciID] IS NULL AND @original_OgrenciID IS NULL))">
                        <DeleteParameters>
                            <asp:Parameter Name="original_OgrenciSertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaNotu" Type="String" />
                            <asp:Parameter Name="original_Tarih" Type="String" />
                            <asp:Parameter Name="original_OgrenciID" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="SertifikaID" Type="Int32" />
                            <asp:Parameter Name="SertifikaNotu" Type="String" />
                            <asp:Parameter Name="Tarih" Type="String" />
                            <asp:Parameter Name="OgrenciID" Type="Int32" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="SertifikaID" Type="Int32" />
                            <asp:Parameter Name="SertifikaNotu" Type="String" />
                            <asp:Parameter Name="Tarih" Type="String" />
                            <asp:Parameter Name="OgrenciID" Type="Int32" />
                            <asp:Parameter Name="original_OgrenciSertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaNotu" Type="String" />
                            <asp:Parameter Name="original_Tarih" Type="String" />
                            <asp:Parameter Name="original_OgrenciID" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource4" runat="server"></asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                        ConflictDetection="CompareAllValues" 
                        ConnectionString="<%$ ConnectionStrings:ebruConnectionString5 %>" 
                        DeleteCommand="DELETE FROM [OgrenciSertfika] WHERE [OgrenciSertifikaID] = @original_OgrenciSertifikaID AND (([SertifikaID] = @original_SertifikaID) OR ([SertifikaID] IS NULL AND @original_SertifikaID IS NULL)) AND (([SertifikaNotu] = @original_SertifikaNotu) OR ([SertifikaNotu] IS NULL AND @original_SertifikaNotu IS NULL)) AND (([Tarih] = @original_Tarih) OR ([Tarih] IS NULL AND @original_Tarih IS NULL)) AND (([OgrenciID] = @original_OgrenciID) OR ([OgrenciID] IS NULL AND @original_OgrenciID IS NULL))" 
                        InsertCommand="INSERT INTO [OgrenciSertfika] ([SertifikaID], [SertifikaNotu], [Tarih], [OgrenciID]) VALUES (@SertifikaID, @SertifikaNotu, @Tarih, @OgrenciID)" 
                        OldValuesParameterFormatString="original_{0}" 
                        SelectCommand="SELECT * FROM [OgrenciSertfika]" 
                        UpdateCommand="UPDATE [OgrenciSertfika] SET [SertifikaID] = @SertifikaID, [SertifikaNotu] = @SertifikaNotu, [Tarih] = @Tarih, [OgrenciID] = @OgrenciID WHERE [OgrenciSertifikaID] = @original_OgrenciSertifikaID AND (([SertifikaID] = @original_SertifikaID) OR ([SertifikaID] IS NULL AND @original_SertifikaID IS NULL)) AND (([SertifikaNotu] = @original_SertifikaNotu) OR ([SertifikaNotu] IS NULL AND @original_SertifikaNotu IS NULL)) AND (([Tarih] = @original_Tarih) OR ([Tarih] IS NULL AND @original_Tarih IS NULL)) AND (([OgrenciID] = @original_OgrenciID) OR ([OgrenciID] IS NULL AND @original_OgrenciID IS NULL))">
                        <DeleteParameters>
                            <asp:Parameter Name="original_OgrenciSertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaNotu" Type="String" />
                            <asp:Parameter Name="original_Tarih" Type="String" />
                            <asp:Parameter Name="original_OgrenciID" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="SertifikaID" Type="Int32" />
                            <asp:Parameter Name="SertifikaNotu" Type="String" />
                            <asp:Parameter Name="Tarih" Type="String" />
                            <asp:Parameter Name="OgrenciID" Type="Int32" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="SertifikaID" Type="Int32" />
                            <asp:Parameter Name="SertifikaNotu" Type="String" />
                            <asp:Parameter Name="Tarih" Type="String" />
                            <asp:Parameter Name="OgrenciID" Type="Int32" />
                            <asp:Parameter Name="original_OgrenciSertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaNotu" Type="String" />
                            <asp:Parameter Name="original_Tarih" Type="String" />
                            <asp:Parameter Name="original_OgrenciID" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ebruConnectionString4 %>" 
                        SelectCommand="SELECT * FROM [OgrenciSertfika]"></asp:SqlDataSource>
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConflictDetection="CompareAllValues" 
                        ConnectionString="<%$ ConnectionStrings:HanedanConnectionString %>" 
                        DeleteCommand="DELETE FROM [Sertifikalar] WHERE [SertifikaID] = @original_SertifikaID AND (([SertifikaAdi] = @original_SertifikaAdi) OR ([SertifikaAdi] IS NULL AND @original_SertifikaAdi IS NULL)) AND (([Sira] = @original_Sira) OR ([Sira] IS NULL AND @original_Sira IS NULL))" 
                        InsertCommand="INSERT INTO [Sertifikalar] ([SertifikaAdi], [Sira]) VALUES (@SertifikaAdi, @Sira)" 
                        OldValuesParameterFormatString="original_{0}" 
                        SelectCommand="SELECT * FROM [Sertifikalar] ORDER BY [Sira]" 
                        UpdateCommand="UPDATE [Sertifikalar] SET [SertifikaAdi] = @SertifikaAdi, [Sira] = @Sira WHERE [SertifikaID] = @original_SertifikaID AND (([SertifikaAdi] = @original_SertifikaAdi) OR ([SertifikaAdi] IS NULL AND @original_SertifikaAdi IS NULL)) AND (([Sira] = @original_Sira) OR ([Sira] IS NULL AND @original_Sira IS NULL))">
                        <DeleteParameters>
                            <asp:Parameter Name="original_SertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaAdi" Type="String" />
                            <asp:Parameter Name="original_Sira" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="SertifikaAdi" Type="String" />
                            <asp:Parameter Name="Sira" Type="Int32" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="SertifikaAdi" Type="String" />
                            <asp:Parameter Name="Sira" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaID" Type="Int32" />
                            <asp:Parameter Name="original_SertifikaAdi" Type="String" />
                            <asp:Parameter Name="original_Sira" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>

    17 Aralık 2014 Çarşamba 15:01

Yanıtlar

Tüm Yanıtlar