易截截图软件、单文件、免安装、纯绿色、仅160KB

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安全编程

在Web编程过程中,存在着很多安全隐患。比如在以前的ASP版本中,Cookie为访问者和编程者都提供了方便,并没有提供加密的功能。打开IE浏览器,选择“工具”菜单里的“Internet选项”,然后在弹出的对话框里单击“设置”按钮,选择“查看文件”按钮,在弹出的窗口中,就会显示硬盘里 ......

asp.net 设置回车的默认按钮

 当我输入一个关键字想按回车键就可以搜索,但由于页面上还有其他的Button,所以默认本不是我的搜索按钮,在网上搜了些解决方案,最多的是如下这种方式:
在asp.net中,如何回车触发指定按钮的事件?
假设:
<asp:TextBox id="tbInput" runat="server" Width="240px"></asp:TextBox>
<asp:Button ......

asp.net向文件写入日志

 using System;
using System.IO;
namespace WriteLog
{
    /// <summary>
    /// WriteInLog 的摘要说明。
    /// </summary>
    public class WriteInLog
......

在UpdatePanel上使用FileUpload上传文件 (asp.net C#)

 
首先我很遗憾的告诉大家,因为微软的偷懒,目前UpdatePanel还不支持文件上传。变相的解决办法就是UpdatePanel中设置PostBackTrigger:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="serv ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号