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);
相关文档:
由于项目需要一个论坛,本来有CS的,在.net下很出名的国外开源论坛。但为了适应国内的风气,最后选用在国内如日中天的Discuz!NT。
将Discuz与asp.net开发的网站整合,有很多人已经完成了。
但在网上没有找到较详细的描述。方法倒是有很多种。
在项目中注册新用户时,也同时调用论坛的用户注册,这样就同步注册了。至于删 ......
下面以Test 站点为例,说明一下如何设置 .net framework 2.0 aspnet_isapi 的 IIS 设置
按如下步骤操作即可
1、打开站点,右击属性,找到主目录(本示例是以虚拟目录,服务器版本请找主目录)
打开如下图所示的窗口
......
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. ......
一).创建部署项目
1. 在“文件”菜单上指向“添加项目”,然后选择“新建项目”。
2. 在“添加新项目”对话框中,选择“项目类型”窗格中的“安装和部署项目”,然后选择“模板”窗格中的“安装项目”。在“名称”框 ......