嘿,给我一个作业,所以我不知道如何将gridvied链接到我的下拉列表,请帮助 [英] Hey am given an assignment so i dont know how to link gridvied to my drop down list please help
本文介绍了嘿,给我一个作业,所以我不知道如何将gridvied链接到我的下拉列表,请帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何使用sql数据库源将下拉列表与griview链接,这是我的代码::
How i link dropdown list with a griview using sql database source here is my code::
Chose category:<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
SelectCommand="SELECT * FROM [tblCategory]">
<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource1" DataTextField="Description"
DataValueField="categoryID">
<br />
<br />
<asp:SqlDataSource ID="moviesource" runat="server"
ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
DeleteCommand="DELETE FROM [tblMovie] WHERE [movieID] = @movieID"
InsertCommand="INSERT INTO [tblMovie] ([movieID], [Title], [Description], [coverPictureURL], [releaseDate], [ageRestriction], [categoryID]) VALUES (@movieID, @Title, @Description, @coverPictureURL, @releaseDate, @ageRestriction, @categoryID)"
SelectCommand="SELECT * FROM [tblMovie]"
UpdateCommand="UPDATE [tblMovie] SET [Title] = @Title, [Description] = @Description, [coverPictureURL] = @coverPictureURL, [releaseDate] = @releaseDate, [ageRestriction] = @ageRestriction, [categoryID] = @categoryID WHERE [movieID] = @movieID">
<deleteparameters>
<asp:Parameter Name="movieID" Type="Int32" />
</deleteparameters>
<insertparameters>
<asp:Parameter Name="movieID" Type="Int32" />
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="coverPictureURL" Type="String" />
<asp:Parameter Name="releaseDate" Type="DateTime" />
<asp:Parameter Name="ageRestriction" Type="String" />
<asp:Parameter Name="categoryID" Type="Int32" />
</insertparameters>
<updateparameters>
<asp:Parameter Name="Title" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="coverPictureURL" Type="String" />
<asp:Parameter Name="releaseDate" Type="DateTime" />
<asp:Parameter Name="ageRestriction" Type="String" />
<asp:Parameter Name="categoryID" Type="Int32" />
<asp:Parameter Name="movieID" Type="Int32" />
</updateparameters>
推荐答案
ConnectionStrings:DatabaseConnectionString%>" =" 选择*来自[tblCategory]" < asp:DropDownList ID =" runat 服务器" =" SqlDataSource1" DataTextField =" span> =" categoryID" < br > < br > < asp:SqlDataSource ID =" runat 服务器" =" <%
ConnectionStrings:DatabaseConnectionString %>" SelectCommand="SELECT * FROM [tblCategory]"> <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1" DataTextField="Description" DataValueField="categoryID"> <br /> <br /> <asp:SqlDataSource ID="moviesource" runat="server" ConnectionString="<%
ConnectionStrings:DatabaseConnectionString%>" =" 从[tblMovie]中删除[movieID] = @movieID" span> =" 插入[tblMovie]([movieID],[Title],[Description],[coverPictureURL],[releaseDate],[ageRestriction],[categoryID])值(@ movieID,@ Title,@ Description,@ coverPictureURL,@ releaseDate,@ ageRestriction,@ categoryID)" =" 选择*来自[tblMovie]" span> =" 更新[tblMovie] SET [标题] = @标题,[描述] = @说明,[coverPictureURL] = @coverPictureURL,[releaseDate] = @releaseDate,[ageRestriction] = @ageRestriction,[类别ID] = @类别ID,[电影ID] = @电影ID" < 删除参数 > < asp:Parameter 名称 =" 类型 Int32 " / < /deleteparameters > < 插入参数 > < asp:Parameter 名称 =" 类型 Int32 " / < asp:Parameter 名称 =" 类型 字符串" / < asp:Parameter 名称 =" 类型 字符串" / < asp:Parameter 名称 =" 类型 字符串" / < asp:Parameter 名称 =" 类型 DateTime " / < asp:Parameter 名称 =" 类型 字符串" / < asp:Parameter 名称 =" 类型 Int32 " / < /insertparameters > < updateparameters > < asp:Parameter 名称 =" 类型 字符串" / < asp:Parameter 名称 =" 类型 字符串" / < asp:Parameter 名称 =" 类型 字符串" / < asp:Parameter 名称 =" 类型 DateTime " / < asp:Parameter 名称 =" 类型 字符串" / < asp:Parameter 名称 =" 类型 Int32 " / < asp:Parameter 名称 =" 类型 Int32 " /> </updateparameters>
ConnectionStrings:DatabaseConnectionString %>" DeleteCommand="DELETE FROM [tblMovie] WHERE [movieID] = @movieID" InsertCommand="INSERT INTO [tblMovie] ([movieID], [Title], [Description], [coverPictureURL], [releaseDate], [ageRestriction], [categoryID]) VALUES (@movieID, @Title, @Description, @coverPictureURL, @releaseDate, @ageRestriction, @categoryID)" SelectCommand="SELECT * FROM [tblMovie]" UpdateCommand="UPDATE [tblMovie] SET [Title] = @Title, [Description] = @Description, [coverPictureURL] = @coverPictureURL, [releaseDate] = @releaseDate, [ageRestriction] = @ageRestriction, [categoryID] = @categoryID WHERE [movieID] = @movieID"> <deleteparameters> <asp:Parameter Name="movieID" Type="Int32" /> </deleteparameters> <insertparameters> <asp:Parameter Name="movieID" Type="Int32" /> <asp:Parameter Name="Title" Type="String" /> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="coverPictureURL" Type="String" /> <asp:Parameter Name="releaseDate" Type="DateTime" /> <asp:Parameter Name="ageRestriction" Type="String" /> <asp:Parameter Name="categoryID" Type="Int32" /> </insertparameters> <updateparameters> <asp:Parameter Name="Title" Type="String" /> <asp:Parameter Name="Description" Type="String" /> <asp:Parameter Name="coverPictureURL" Type="String" /> <asp:Parameter Name="releaseDate" Type="DateTime" /> <asp:Parameter Name="ageRestriction" Type="String" /> <asp:Parameter Name="categoryID" Type="Int32" /> <asp:Parameter Name="movieID" Type="Int32" /> </updateparameters>
这篇关于嘿,给我一个作业,所以我不知道如何将gridvied链接到我的下拉列表,请帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文