ACCESS使用ADO.NET取得亂數資料

ACCESS使用ADO.NET取得亂數資料

 
 
 
 
        Random rnd = new Random(unchecked((int)DateTime.Now.Ticks));

        int intRandomNumber = rnd.Next();

using (OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Baystars.mdb;Persist Security Info=True"))
        {
            using (OleDbCommand comm = new OleDbCommand("select * from Product order by rnd(" + ((-1 * intRandomNumber).ToString()) + "*Productid)", conn))
            {
                using (OleDbDataAdapter dar = new OleDbDataAdapter(comm))

                {
                    DataSet ds = new DataSet();
                    dar.Fill(ds);
                    //取得資料
                    GridView1.DataSource = ds.Tables[0].DefaultView;
                    GridView1.DataBind();
                }

            }

        }

.NET很奇怪..我在工具上使用RND(id)會有亂數排列

但是一在頁面上取資料功能就不見了...