我已经把图片的路径存到了数据库里了(不是转换成二进制存,存的只是图片路径),怎么读取图片用按钮“上一张”“下一张”显示图片。跪求!!!!
解决方案 »
- 新手请教:C# 实现访问服务器
- 问个关于C++的dll转换成C#的问题,使用DllImport
- 关于水晶报表在“推模式”下怎么分组(winform cs结构)?(附图)
- (WinForm)请问我想程序在运行时根据自身是Debug或Release版本运行不同的函数,应该用什么语句来判断?
- 关于【ASP.NET】控件的若干问题
- 激活Winform窗体
- 如何让生成的ws 客户端代码分为几个文件,而不是一个文件?
- 急!关于gridview编辑是updating事件到数据类型错误
- 大文件传输的非常难题!高分求教!500分分次支付,绝无虚假!
- ManagementObject与ManagementBaseObject这两个类有什么区别?
- C#将二进制流转换为图片
- c#怎样用this.Invoke()方法
2:每点击一次就查询一下你要得到的数据
{
if(!Page.IsPostBack)
{
SqlConnection conn=new SqlConnection()
conn.ConnectionString="Data Source=localhost;Database=test;User Id=sa;Pwd=sa";
string strSql="select * from test where id=2";//这里假设获取id为2的图片
SqlCommand cmd=new SqlCommand(strSql,conn);
conn.Open();
SqlDataReader reader=cmd.ExecuteReader();
reader.Read();
Response.ContentType="application/octet-stream";
Response.BinaryWrite((Byte[])reader["FImage"]);
Response.End();
reader.Close();
}
}
Response.BinaryWrite((Byte[])reader["FImage"]);
这2句什么意思?
“上一张”“下一张”2个按钮的CS代码怎么写?
谢谢
select top 1 * from table1 from id>@id where 1=1 order by id
select top 1 * from table1 from id<@id where 1=1 order by id desc
调用存储过程或执行SQL语句
using(SqlConnection conn=new SqlConnection(""))
{
SqlCommand cmd=new SqlCommand("",conn);
conn.open();
...
}
spqparameter参数为@id
或使用LINQ 排序skip,take(1)
菜鸟崩溃了~~~~