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);
Ïà¹ØÎĵµ£º
µ±ÎÒÊäÈëÒ»¸ö¹Ø¼ü×ÖÏë°´»Ø³µ¼ü¾Í¿ÉÒÔËÑË÷£¬µ«ÓÉÓÚÒ³ÃæÉÏ»¹ÓÐÆäËûµÄButton,ËùÒÔĬÈϱ¾²»ÊÇÎÒµÄËÑË÷°´Å¥£¬ÔÚÍøÉÏËÑÁËЩ½â¾ö·½°¸£¬×î¶àµÄÊÇÈçÏÂÕâÖÖ·½Ê½£º
ÔÚasp.netÖУ¬ÈçºÎ»Ø³µ´¥·¢Ö¸¶¨°´Å¥µÄʼþ£¿
¼ÙÉ裺
<asp:TextBox id="tbInput" runat="server" Width="240px"></asp:TextBox>
<asp:Button ......
using System;
using System.IO;
namespace WriteLog
{
/// <summary>
/// WriteInLog µÄժҪ˵Ã÷¡£
/// </summary>
public class WriteInLog
......
1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
´«ËͲÎÊý£º
response.write("£¼script£¾window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')£¼/script£¾")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1.Attributes. ......
»ñÈ¡ÇëÇóµÄÒ³µÄ HttpRequest ¶ÔÏó¡£
Ò»¡¢HttpRequest Àà
ʹ ASP.NET Äܹ»¶ÁÈ¡¿Í»§¶ËÔÚ Web ÇëÇóÆڼ䷢Ë굀 HTTP Öµ¡£
ÏÂÃæµÄ´úÂëʾÀýʹÓà StreamWriter ÀཫÈô¸É HttpRequest ÀàÊôÐÔÖµµÄֵдÈëÎļþ¡£¶ÔÓÚÊÇ×Ö·û´®ÀàÐ͵ÄÊôÐÔ£¬ÊôÐÔÖµ±»Ð´ÈëÎļþʱ½«±»±àÂëΪ HTML¡£±íʾ¼¯ºÏµ ......