C#读取sqlserver 动画flash swf 文件到本地硬盘
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button2_Click(object sender, EventArgs e)
{
//把图片保存成数据库二进制形式
Stream ImageStream;
string Path = FileUpload1.PostedFile.FileName;// 文件名称
int Size = FileUpload1.PostedFile.ContentLength; // 文件大小
string Type = FileUpload1.PostedFile.ContentType; // 文件类型
ImageStream = FileUpload1.PostedFile.InputStream;
byte[] Content = new byte[Size];
int Status = ImageStream.Read(Content, 0, Size);
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand comm = new SqlCommand("insert into testimage (UserName,Image,Path,Type) values(@UserName,@Image,@Path,@Type)", conn);
comm.CommandType = CommandType.Text;
comm.Parameters.Add("@UserName", SqlDbType.VarChar, 255).Value = txtUserName.Text;
comm.Parameters.Add("@Image", SqlDbType.Image).Value = Content;
comm.Parameters.
相关文档:
======================SqlServer大部分知识都在我这脚本里===============
如果你能把数据结构画出来的话,那么你就入门了!!呵呵!!
--查看konwyoumore库是否存在
USE master
IF exists(SELECT * from sysdatabases WHERE name='KnowYouMore')
BEGIN
DROP DATABASE knowyoumore;
END
GO
--创建konwyo ......
Create Procedure up_InsertData2
@ID INT
AS
BEGIN
Declare @Name NVARCHAR(30)
Declare @c1 NVARCHAR(30)
Declare @c2 NVARCHAR(30)
Declare @c3 NVARCHAR(30)
Declare @c4 NVARCHAR(30)
Declare tmpCur Cursor For Select a,b,c,d from table1
Open tmpCur;
Fetch Next from tmpCur Into @c1,@c2,@c3 ......
在SQL语句中通过系统存储过sp_addextendedproperty可为表字段添加上动态的说明(备注)下面是SQL SERVER帮助文档中对sp_addextendedproperty存储过程的描述
语法
sp_addextendedproperty
[ @name = ] { 'property_name' }
[ , [ @value = ] { 'value' }
&nbs ......
SQL SERVER临时表
也可以创建临时表。临时表与永久表相似,但临时表存储在 tempdb 中,当不再使用时会自动删除。
有本地和全局两种类型的临时表,二者在名称、可见性和可用性上均不相同。本地临时表的名称以单个数字符号 (#) 打头;
它们仅对当前的用户连接是可见的;当用户从 Microsoft? SQL Server? 2000 实例断 ......
NVL(Expr1,Expr2)如果Expr1为NULL,返回Expr2的值,否则返回Expr1的值
NVL2(Expr1,Expr2,Expr3)如果Expr1为NULL,返回Expr2的值,否则返回Expr3的值
NULLIF(Expr1,Expr2)如果Expr1和Expr2的值相等,返回NULL,否则返回Expr1的值 ......