首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > ASP.NET > 图片上传的数据库部分
【标  题】:图片上传的数据库部分
【关键字】:数据库,上传,图片
【来  源】:网络

图片上传的数据库部分


    public int FePicDataSet(string strPicTitle, string strPicDate, string strPicName, int intPicType, string strPicIntro, string strThumbnail, int opID)
        {

            //string strPicTitle,
            //string strPicDate,
            //string strPicName,
            //int intPicType,
            //string strPicIntro,
            //string strPicName,
            //string strThumbnail,
            //int opID
            SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
            SqlCommand myCommand = new SqlCommand("mag_FePicDataSet", myConnection);
            // Mark the Command as a SPROC
            myCommand.CommandType = CommandType.StoredProcedure;

            // Add Parameters to SPROC
            SqlParameter parameterUserId = new SqlParameter("@opID", SqlDbType.Int);
            parameterUserId.Value = opID;
            myCommand.Parameters.Add(parameterUserId);
            
            SqlParameter parameterPicTitle = new SqlParameter("@picTitle", SqlDbType.Char, 30);
            parameterPicTitle.Value = strPicTitle;            
            myCommand.Parameters.Add(parameterPicTitle);

            SqlParameter parameterPicDate = new SqlParameter("@picDate", SqlDbType.Char, 10);
            parameterPicDate.Value = strPicDate;
            myCommand.Parameters.Add(parameterPicDate);        

            SqlParameter parameterPicName = new SqlParameter("@picName", SqlDbType.Char, 50);
            parameterPicName.Value = strPicName;
            myCommand.Parameters.Add(parameterPicName);        

            SqlParameter parameterPicType = new SqlParameter("@picType", SqlDbType.Int);
            parameterPicType.Value = intPicType;
            myCommand.Parameters.Add(parameterPicType);        

            SqlParameter parameterPicIntro = new SqlParameter("@picIntro", SqlDbType.Char, 255);
            parameterPicIntro.Value = strPicIntro;
            myCommand.Parameters.Add(parameterPicIntro);
        
            SqlParameter parameterThumbnail = new SqlParameter("@thumbnail", SqlDbType.Char, 50);
            parameterThumbnail.Value = strThumbnail;
            myCommand.Parameters.Add(parameterThumbnail);        

            SqlParameter parameterHostAddress = new SqlParameter("@opIP", SqlDbType.Char, 15);
            parameterHostAddress.Value = Context.Request.UserHostAddress;                
            myCommand.Parameters.Add(parameterHostAddress);    

            //SqlParameter parameterRID = new SqlParameter("@returnID", SqlDbType.Int);
            //parameterReturnUserID.Value = -1;
            //parameterRID.Direction = ParameterDirection.Output;
            //myCommand.Parameters.Add(parameterRID);

            
            
            // Execute the command in a try/catch to catch duplicate username errors
            try
            {
                // Open the connection and execute the Command
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch
            {

                // failed to create a new user
                return -1;
            }
            finally
            {

                // Close the Connection
                if (myConnection.State == ConnectionState.Open)
                    myConnection.Close();
            }

            return 1;

        }

图片上传的功能简介及web.config设置:【上一篇】
图片上传的WebForm:【下一篇】
【相关文章】
  • 图片上传的功能简介及web.config设置
  • 数据库连接字在Web.config里的用法
  • Asp.net+Xml实现无数据库论坛一点即通
  • 用ASP.NET/C#连接Access和SQL Server数据库
  • (ASP.NET)修改和删除DataGrid行——数据库访问
  • 将一个图片按比例缩放显示在一个Frame中
  • .Net在SqlServer中的图片存取技术
  • 如何在ASP.NET中显示数据库中的数据
  • Perl操作Mysql数据库
  • Dreamweaver MX 2004 图片处理
  • 【随机文章】
  • AcpSampleP204.mixal
  • 打印耗材常见问题与基础知识
  • 使用Visual C++.Net2005托管时的几个问题
  • 添加控制文件
  • OSGi离企业应用有多远
  • 爱上“斗地主”
  • DNS系统维护
  • 当没有用 EXISTS 引入子查询时,在选择列表中只能指定一个表达式的解决办法
  • Gnutella数据包分析
  • 常用的 ASP ActiveX 组件
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.