Hello to everybody,
I'm a beginner in aspnet programming and I thought to become a member of this forum to learn better how to
program in this language (I use c# as code-behind language and visual studio 2008 environment).
I have a problem to solve: I want to display, on an aspnet page load, 12 random images taken from a mysql
I used connector-net in order to make mysql recognized by visual studio, I established a connection with the
database and I could display the content of 12 random rows of the table (eg ImageName, see below).
The database contains these columns:
ImageCode, ImageName, MaskName, ImageType
For example for the first row I have:
I post you the code of the pageload I have written:
protected void Page_Load(object sender, EventArgs e)
string myConnectionString =
conn = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
string sql = "SELECT * FROM images ORDER BY RAND() limit 12";
MySqlCommand cmd = new MySqlCommand(sql, conn);
MySqlDataReader rdr = cmd.ExecuteReader();
Response.Write(rdr + " -- " + rdr);
With this code I display the url of 12 random images but I want to display the images itself.
Can anyone tell me how can I do step by step with the relative code?
Thanks in advance, I can't proceedRead more...