看了一晚上 没看出来 哪错了...
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.IO;
using System.Data.SqlClient;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
public partial class _homework2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
String Caption = TextBox1.Text;
bool IsPublic = false;
if (CheckBox1.Checked)
IsPublic = true;
AddAlbum(Caption, IsPublic);
Label3.Text = "相册建立成功! " ;
}
public static void AddAlbum(string Caption, bool IsPublic)
{
SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings[ "Personal "].ConnectionString);
string sql;
sql = "INSERT INTO[Albums]([Caption],[IsPublic])VALUES(@Caption,@IsPublic) ";
SqlCommand command = new SqlCommand(sql, connection);
command.Parameters.Add(new SqlParameter( "@Caption ", Caption));
command.Parameters.Add(new SqlParameter( "@IsPublic ", IsPublic));
connection.Open();
command.ExecuteNonQuery();
}
private static Size CalculateDimensions(Size oldSize, int targetSize)
{
Size newSize = new Size();
if (oldSize.Height > oldSize.Width)
{
newSize.Width = (int)(oldSize.Width * ((float)targetSi