| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 469 人关注过本帖
标题:c#存文件入库找不到存储过程
只看楼主 加入收藏
眼圈黑黑
Rank: 2
等 级:论坛游民
帖 子:27
专家分:20
注 册:2010-4-7
结帖率:60%
收藏
 问题点数:0 回复次数:0 
c#存文件入库找不到存储过程
错误提示:找不到存储过程"ImageUpdate"

源码如下:
using System;
using
using System.Data.SqlClient;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TestIO
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open);
                int imgLen = (int)fs.Length;
                byte[] imgBinaryData = new byte[imgLen];
                int nBytesRead = fs.Read(imgBinaryData, 0, imgLen);
                string strConn = "Data Source=MS-201205202003\\SQLEXPRESS;";
                strConn += "Initial Catalog=Northwind;";
                strConn += "User ID=sa;";
                strConn +="Password=1989117;";
                SqlConnection Conn = new SqlConnection(strConn);
                try
                {
                    SqlCommand oCmd = new SqlCommand("ImageUpdate", Conn);
                     = CommandType.StoredProcedure;
                    oCmd.Parameters.Add("@CategoryID",SqlDbType.Int).Value = 5;
                    oCmd.Parameters.Add("@imageData", SqlDbType.Image).Value = imgBinaryData;
                    oCmd.Connection.Open();
                    oCmd.ExecuteNonQuery();
                    oCmd.Connection.Close();
                    MessageBox.Show("图像数据已经存入数据库");
                }
                catch(Exception oExcept)
                {
                    MessageBox.Show(oExcept.Message);
                }
                fs.Close();
            }
        }
    }
}
搜索更多相关主题的帖子: 存储 void private public 
2012-07-10 20:11
快速回复:c#存文件入库找不到存储过程
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.029379 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved