asp.net¶ÔͼƬµÄ¶Áд
дͼƬc:\1.jpgµ½±ícinfoÖÐ
private static void AddCinfo()
{
string strSql = "insert into cinfo (srvtitle,csttitle,introduction,logo) values
(@srvtitle,@csttitle,@introduction,@logo)";
SqlParameter[] parms =
{
new SqlParameter("@srvtitle",SqlDbType.VarChar,30),
new SqlParameter("@csttitle",SqlDbType.VarChar,30),
new SqlParameter("@introduction",SqlDbType.NVarChar,500),
new SqlParameter("@logo",SqlDbType.Image)
};
parms[0].Value = "ÂÃÒµ»¥¶¯";
parms[1].Value = "lyhd";
parms[2].Value = "¼ò½é";
string filePath = @"c:\1.jpg";
FileStream fs = File.OpenRead(filePath);
byte[] content = new byte[fs.Length];
fs.Read(content, 0, content.Length);
fs.Close();
parms[3].Value = content;
DBHelper.ExecuteNonQuery(CommandType.Text, strSql, parms);
}
¶ÁȡͼƬµÄÒ³Ãæ test.aspx
protected void Page_Load(object sender, EventArgs e)
{
string strSql = "select * from cinfo where id=1";
SqlDataReader reader=DBHelper.ExecuteReader(CommandType.Text, strSql, null);
Ïà¹ØÎĵµ£º
ÓÃasp.net µÄ»ØÖ´(postback)ÊǺÜˬ£¬µ«ÈôÒ»¸ö³¤³¤µÄÒ³Ãæ£¬Ò»»ØÖ´ºó£¬Ìøµ½ÁËÒ³Ê×£¬ÌåÑ鲻ˬ¡£ µ«ÔÚasp.netµÄpageÒ³ÃæÀïÃæÓÐÒ»¸öºÜˬµÄÊôÐÔPage.MaintainScrollPositionOnPostBack ÊôÐÔ£¬ÉèΪtrue¼´¿É¡£ »ñÈ¡»òÉèÖÃÒ»¸öÖµ£¬¸Ãֵָʾ»Ø·¢ºóÊÇ·ñ½«Óû§·µ»Øµ½¿Í»§¶Ëä¯ÀÀÆ÷ÖеÄͬһλÖᣠ<%@ Page Title="" Lang ......
ÔÌûµØÖ·:http://blog.cnria.com/post/aspnet-form-e5b58ce5a597-e68f90e4baa4e9a1b5e99da2e79a84e8a7a3e586b3e696b9e6b395-from-e5b58ce5a597-aspnet-e8a1a8e58d95.aspx
Õâ¸öÎÊÌâµÄÔÒòÆäʵ²¢²»ÊÇasp.net ÔËÐлúÖÆµÄÔÒò£¬¶øÊÇÒòΪÔÚhtmlÖб¾Éí¾Í²»ÔÊÐíform±êǩǶÌ×ʹÓã¬ÎÒÊÔ¹ýdocument.getelementbyid("search&q ......
Ê×ÏÈÎÒºÜÒź¶µÄ¸æËß´ó¼Ò£¬ÒòΪ΢ÈíµÄ͵ÀÁ£¬Ä¿Ç°UpdatePanel»¹²»Ö§³ÖÎļþÉÏ´«¡£±äÏàµÄ½â¾ö°ì·¨¾ÍÊÇUpdatePanelÖÐÉèÖÃPostBackTrigger£º
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="serv ......
ASP.NETÖ¸ÁîÔÚÿ¸öASP.NETÒ³ÃæÖж¼ÓС£Ê¹ÓÃÕâЩָÁî¿ÉÒÔ¿ØÖÆASP.NETÒ³ÃæµÄÐÐΪ¡£ÏÂÃæÊÇPageÖ¸ÁîµÄÒ»¸öÀý×Ó£º
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
ÔÚASP.NETÒ³Ãæ»òÓû§¿Ø¼þÖÐÓÐ11¸öÖ¸Áî¡£ÎÞÂÛÒ³ÃæÊÇʹÓúǫ́±àÂëÄ£ÐÍ»¹ÊÇÄÚÖñ ......