Discussion:
如何隨機讀出Access資料庫中的記錄
(时间太久无法回复)
tony
2006-09-08 11:13:42 UTC
Permalink
œÐ±ÐŠUŠì:
§ÚšÏ¥Î¥H€U¥NœX,µLªk¹ê²{±qACCESSžê®Æ®w€€ÀHŸ÷Ū¥XŒÆŸÚ,œÐ°Ý­nŠpŠó€~¯à¹ê²{.ÁÂÁÂ!
<asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/tdb/tdb.mdb"
SelectCommand="SELECT *, Rnd([ID]) AS Expr1 FROM Answer WHERE (TitleID = ?) ORDER BY Rnd([ID])">
<SelectParameters>
<asp:ControlParameter ControlID="IDLabel" Name="TitleID" PropertyName="Text" Type="Int32" />
</SelectParameters>
</asp:AccessDataSource>
璉璉
2006-09-09 01:25:30 UTC
Permalink
€£€Ó²M·¡§Aªº¥Øªº¡C

œÐ©úœT»¡©ú¥H€Ušâ¶µ¡G
1. Š³¿ù»~œÐ»¡¿ù»~°T®§
2. ¹wŽÁŠšªG»P§A²{Šb±ošìŠšªGªº®t²§

§A²{Šbªº¬džß©R¥O¬OŠb TitleID = xxx ±ø¥ó€U¡A©ÒŠ³ªº¶µ¥Ø¥Ž¶Ã­ì¥ýªº¶¶§Ç¡A¶ÇŠ^šÓ¡C
©ó news:eTGTifz0GHA.1040%40TK2MSFTNGP06.phx.gbl µoªí
§ÚšÏ¥Î¥H€U¥NœX,µLªk¹ê²{±qACCESSžê®Æ®w€€ÀHŸ÷Ū¥XŒÆŸÚ,œÐ°Ý­nŠpŠó€~¯à¹ê²{.ÁÂÁÂ!
<asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/tdb/tdb.mdb"
SelectCommand="SELECT *, Rnd([ID]) AS Expr1 FROM Answer WHERE (TitleID = ?) ORDER BY Rnd([ID])">
<SelectParameters>
<asp:ControlParameter ControlID="IDLabel" Name="TitleID" PropertyName="Text" Type="Int32" />
</SelectParameters>
</asp:AccessDataSource>
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.3 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.twbbs.org/wwwmap.htm
¬y°ìšŸ¬x/°Ï°ì€ôžê·œ/®}ª@ºô/ªŽºÀ¹Ï/»y­µ³q°T €å³¹»Pµ{Š¡
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
·L³nµ{Š¡³]­p·s°Qœ×°Ï MSDN §Þ³Nœ×ŸÂ¡Aºô€ÍŠ^ÂЫá§Y®É²°T¡B¹q€l¶l¥ó³qªŸ¡G
http://forums.microsoft.com/msdn-cht/default.aspx?siteid=14
--
ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx
RSS 2.0 http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
tony
2006-09-09 05:31:59 UTC
Permalink
±zŠn!

§Ú¥Ø«e°µªº¬O€@­ÓŠbœuŠÒžÕªºšt²Î(asp.net+Access),¥Ø«eªº°ÝÃD¬OšÏ¥Î
SelectCommand="SELECT ...... ORDER BY Rnd([ID])",µLªkÀHŸ÷šú¥XTABLE€€ªºžÕÃD
Post by 璉璉
€£€Ó²M·¡§Aªº¥Øªº¡C
œÐ©úœT»¡©ú¥H€Ušâ¶µ¡G
1. Š³¿ù»~œÐ»¡¿ù»~°T®§
2. ¹wŽÁŠšªG»P§A²{Šb±ošìŠšªGªº®t²§
§A²{Šbªº¬džß©R¥O¬OŠb TitleID = xxx ±ø¥ó€U¡A©ÒŠ³ªº¶µ¥Ø¥Ž¶Ã­ì¥ýªº¶¶§Ç¡A¶ÇŠ^
šÓ¡C
Post by 璉璉
©ó news:eTGTifz0GHA.1040%40TK2MSFTNGP06.phx.gbl µoªí
§ÚšÏ¥Î¥H€U¥NœX,µLªk¹ê²{±qACCESSžê®Æ®w€€ÀHŸ÷Ū¥XŒÆŸÚ,œÐ°Ý­nŠpŠó€~¯à¹ê²{.
ÁÂÁÂ!
Post by 璉璉
<asp:AccessDataSource ID="AccessDataSource2"
runat="server" DataFile="~/tdb/tdb.mdb"
Post by 璉璉
SelectCommand="SELECT *, Rnd([ID]) AS Expr1 FROM
Answer WHERE (TitleID = ?) ORDER BY Rnd([ID])">
Post by 璉璉
<SelectParameters>
<asp:ControlParameter ControlID="IDLabel"
Name="TitleID" PropertyName="Text" Type="Int32" />
Post by 璉璉
</SelectParameters>
</asp:AccessDataSource>
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.3 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.twbbs.org/wwwmap.htm
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
·L³nµ{Š¡³]­p·s°Qœ×°Ï MSDN §Þ³Nœ×ŸÂ¡Aºô€ÍŠ^ÂЫá§Y®É²°T¡B¹q€l¶l¥ó³qªŸ¡G
http://forums.microsoft.com/msdn-cht/default.aspx?siteid=14
--
ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx
RSS 2.0
http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=microsoft.publ
ic.tw.dotnet.framework.aspnet
tony
2006-09-09 06:30:57 UTC
Permalink
€wžgºN¯Á¥Xµª®×
§ÚŠ³šâ­ÓTable,€@¬OÃD¥ØTitle,€G¬Oµª®×Answer
ÃD¥ØšÏ¥Îdatalist SHOW¥X
µMŠZŠbdatalist€€Ž¡€J€@gridview¥Î€_Åã¥Ü¬ÛÀ³ªºµª®×,¥H€U¬°µª®×ÀHŸ÷¶¶§ÇÅã¥Üªº¥N
œX.
Protected Sub DataList1_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs) Handles
DataList1.ItemCreated
Dim Strsql2 As String = "SELECT * FROM [Answer] WHERE ([TitleID] =
?) ORDER BY Rnd(-([ID]+" & Int(Rnd() * 10) & "))"
Dim AccessDataSource2 As AccessDataSource =
e.Item.FindControl("accessdatasource2")
AccessDataSource2.SelectCommand = Strsql2
End Sub
Post by tony
±zŠn!
SelectCommand="SELECT ...... ORDER BY Rnd([ID])",µLªkÀHŸ÷šú¥XTABLE€€ªºžÕÃD
Post by 璉璉
€£€Ó²M·¡§Aªº¥Øªº¡C
œÐ©úœT»¡©ú¥H€Ušâ¶µ¡G
1. Š³¿ù»~œÐ»¡¿ù»~°T®§
2. ¹wŽÁŠšªG»P§A²{Šb±ošìŠšªGªº®t²§
§A²{Šbªº¬džß©R¥O¬OŠb TitleID = xxx ±ø¥ó€U¡A©ÒŠ³ªº¶µ¥Ø¥Ž¶Ã­ì¥ýªº¶¶§Ç¡A¶Ç
Š^
Post by tony
šÓ¡C
Post by 璉璉
©ó news:eTGTifz0GHA.1040%40TK2MSFTNGP06.phx.gbl µoªí
§ÚšÏ¥Î¥H€U¥NœX,µLªk¹ê²{±qACCESSžê®Æ®w€€ÀHŸ÷Ū¥XŒÆŸÚ,œÐ°Ý­nŠpŠó€~¯à¹ê²{
.
Post by tony
ÁÂÁÂ!
Post by 璉璉
<asp:AccessDataSource ID="AccessDataSource2"
runat="server" DataFile="~/tdb/tdb.mdb"
Post by 璉璉
SelectCommand="SELECT *, Rnd([ID]) AS Expr1 FROM
Answer WHERE (TitleID = ?) ORDER BY Rnd([ID])">
Post by 璉璉
<SelectParameters>
<asp:ControlParameter ControlID="IDLabel"
Name="TitleID" PropertyName="Text" Type="Int32" />
Post by 璉璉
</SelectParameters>
</asp:AccessDataSource>
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.3 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.twbbs.org/wwwmap.htm
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
·L³nµ{Š¡³]­p·s°Qœ×°Ï MSDN §Þ³Nœ×ŸÂ¡Aºô€ÍŠ^ÂЫá§Y®É²°T¡B¹q€l¶l¥ó³qªŸ¡G
http://forums.microsoft.com/msdn-cht/default.aspx?siteid=14
--
ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx
RSS 2.0
http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=microsoft.publ
Post by tony
ic.tw.dotnet.framework.aspnet
Loading...