actors.aspx.cs

来自「A Portal for uploading images, videos an」· CS 代码 · 共 39 行

CS
39
字号
using System;
using System.Data;
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;
using System.Data.SqlClient;

public partial class Actors : System.Web.UI.Page
{
    SqlConnection sqlcon = new SqlConnection();
    SqlCommand sqlcmd = new SqlCommand();
    SqlDataAdapter sqlda = new SqlDataAdapter();
    String connectionString = "Data Source=JP11;Initial Catalog=starsparkz;Integrated Security=True";
    String uimgurl;
    String god;
    protected void Page_Load(object sender, EventArgs e)
    {
        SqlConnection sqlcon = new SqlConnection(connectionString);
        sqlcon.Open();
        SqlCommand sqlcmd = new SqlCommand("select FileName from photo where Category='Actors'", sqlcon);
        SqlDataAdapter sqlda = new SqlDataAdapter(sqlcmd);
        DataSet ds = new DataSet();
        sqlda.Fill(ds);
        foreach (DataRow dr in ds.Tables[0].Rows)
        {
            Response.Write("<a href='#'>");
            Response.Write("<img src='images/" + dr[0].ToString() + "' width='100' border='0'>");
            Response.Write("</a>&nbsp;&nbsp;&nbsp;");
        }        
        sqlcon.Close();

    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?