using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class RandomBook : System.Web.UI.UserControl
{
datautl dut = new datautl();
string[] queries = new string[6];
int count1;
protected void Page_Load(object sender, EventArgs e)
{
random();
Random1();
}
#region randombook
void random()
{
string myData = string.Empty;
string strSql1 = "select count(sno) from B_Book";
SqlDataReader drcount1 = dut.ExecuteReader(strSql1);
if (drcount1.HasRows)
{
drcount1.Read();
count1 = Convert.ToInt32(drcount1[0]);
}
Random randnum = new Random();
//myData = myData + "<table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' style='position: relative' bgcolor='#E5E5E5'>";
//myData = myData + "<tbody>";
for (int i = 0; i < 6; i++)
{
int num = randnum.Next(1, count1);
queries[i] = "select B_Book.*,B_Category.category as category,B_Category.sno as sno1 from B_Book,B_Category where B_Book.sno = " + num + " and B_Category.sno=B_Book.Cat_id";
//string strSqlques = "select B_Book.*,B_Category.category as category,B_Category.sno as sno1 from B_Book,B_Category where B_Book.sno = " + num + " and B_Category.sno=B_Book.Cat_id";
//SqlDataReader dr = dut.ExecuteReader(strSqlques);
// if (dr.Read())
// {
// myData = myData + "<tr>";
// myData = myData + "<td class='bookname' height='4'><div align='left'></td>";
// myData = myData + "</tr>";
// myData = myData + "<tr>";
// myData = myData + "<td height='4'class='grey1'><a href='Book_Details.aspx?H=1&ID=" + dr["sno"] + "&AID=" + dr["Author_1"] + "&Catname=" + dr["category"] + "' class='grey1'><strong>" + dr["Book_name"] + "</strong></a></td>";
// //myData = myData + "<td height='4'class='grey1'><a href='Book_Details.aspx?ID=" + dr["sno"] + "&AID=" + dr["Author_1"] + "&Catname=" + dr["category"] + "'><img src = 'UploadData/" + dr["Book_Image"].ToString() + "' width='100' height='162' border='0'><strong>" + dr["Book_name"].ToString() + "</strong></a></td>";
// myData = myData + "</tr>";
// myData = myData + "<tr>";
// myData = myData + "<td valign='top'><div align='left'>";
// myData = myData + "<table cellspacing='0' cellpadding='0' width='100%' border='0'>";
// myData = myData + "<tbody>";
// myData = myData + "<tr>";
// myData = myData + "<td valign='top' width='90' align='center'>";
// myData = myData + "<img src='UploadData/"+ dr["Book_Image"]+"' width='100' height='150' /></td>";
// myData = myData + "<td class='grey' valign='top'><br />";
// myData = myData + "</td>";
// myData = myData + "</tr>";
// myData = myData + "</tbody>";
// myData = myData + "</table>";
// myData = myData + "</div></td>";
// myData = myData + "</tr>";
// myData = myData + "<tr>";
// myData = myData + " <td class='red' height='5'><div align='left'><U></U><strong></strong></div></td>";
// myData = myData + "</tr>";
// }
//dr.Close();
}
// myData = myData + "</tbody>";
// myData = myData + "</table>";
// myLabel.InnerHtml = myData;
//Response.Write(queries[0].ToString());
// }
}
#endregion
//******************************Random book1********************************************************
private void Random1()
{
string str1 = queries[0].ToString();
DataSet ds1 = new DataSet();
ds1 = dut.Display(str1);
ddl_listR1.DataSource = ds1;
ddl_listR1.DataBind();
string str2 = queries[1].ToString();
DataSet ds2 = new DataSet();
ds2 = dut.Display(str2);
ddl_listR2.DataSource = ds2;
ddl_listR2.DataBind();
string str3 = queries[2].ToString();
DataSet ds3 = new DataSet();
ds3 = dut.Display(str3);
ddl_listR3.DataSource = ds3;
ddl_listR3.DataBind();
string str4 = queries[3].ToString();
DataSet ds4 = new DataSet();
ds4 = dut.Display(str4);
ddl_listR4.DataSource = ds4;
ddl_listR4.DataBind();
string str5 = queries[4].ToString();
DataSet ds5 = new DataSet();
ds5 = dut.Display(str5);
ddl_listR5.DataSource = ds5;
ddl_listR5.DataBind();
string str6 = queries[5].ToString();
DataSet ds6 = new DataSet();
ds6 = dut.Display(str6);
ddl_listR6.DataSource = ds6;
ddl_listR6.DataBind();
}
//*************************************************************************************
}
2 comments :
Correct your spell first "uesing" not it is using. Then try to write article...
You are writing a article pls correct the spell of uesing
Post a Comment