public static int Update(string title, string addTime, string content, int typeID, int id,string rollimg)
    {
        OleDbConnection con = DBcon.createcon();
        con.Open();
        string cmdText = "Update News Set NewsTitle=?, AddTime=?, Content=?, TypeID=?, RollImg=?  Where ID=?";
        OleDbCommand cmd = new OleDbCommand(cmdText, con);
        cmd.Parameters.Add("?", OleDbType.LongVarWChar, 60).Value = title;
        cmd.Parameters.Add("?", OleDbType.LongVarWChar, 60).Value = addTime;
        cmd.Parameters.Add("?", OleDbType.LongVarChar).Value = content;
        cmd.Parameters.Add("?", OleDbType.Integer, 4).Value = typeID;
        cmd.Parameters.Add("?", OleDbType.LongVarChar).Value = rollimg;
        cmd.Parameters.Add("?", OleDbType.Integer).Value = id;
        int result = cmd.ExecuteNonQuery();
        con.Close();
        return result;
      
    }

public static int Add(string title, string addtime, string content, int typeID,string rollImg)
    {
        OleDbConnection con = DBcon.createcon();
        con.Open();
        string cmdText = "Insert into  News(NewsTitle,AddTime,Content,RollImg,TypeID) Values (?,?,?,?,?)";
        OleDbCommand cmd = new OleDbCommand(cmdText, con);
        cmd.Parameters.Add("?", OleDbType.LongVarWChar, 60).Value = title;
        cmd.Parameters.Add("?", OleDbType.LongVarWChar, 60).Value = addtime;
        cmd.Parameters.Add("?", OleDbType.LongVarChar).Value = content;
        cmd.Parameters.Add("?", OleDbType.LongVarChar).Value = rollImg;
        cmd.Parameters.Add("?", OleDbType.Integer, 4).Value = typeID;
        int result = cmd.ExecuteNonQuery();
        con.Close();
        return result;
    }

public DataSet GetDataSetFromAdapter(
    DataSet dataSet, string connectionString, string queryString)
{
    using (OleDbConnection connection =
               new OleDbConnection(connectionString))
    {
        OleDbDataAdapter adapter =
            new OleDbDataAdapter(queryString, connection);

// Set the parameters.
        adapter.SelectCommand.Parameters.Add(
            "@CategoryName", OleDbType.VarChar, 80).Value = "toasters";
        adapter.SelectCommand.Parameters.Add(
            "@SerialNum", OleDbType.Integer).Value = 239;

// Open the connection and fill the DataSet.
        try
        {
            connection.Open();
            adapter.Fill(dataSet);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        // The connection is automatically closed when the
        // code exits the using block.
    }
    return dataSet;
}

OleDbParameter 在Access中的用法相关推荐

  1. access中的Format用法详解

    access中的Format用法详解 Format$(Now,"EEOA") 只要这么一句~~~~~就可以得到" 二○○六年五月二十六日" ---------- ...

  2. 在Access中执行SQL语句

    Access在小型系统开发中等到了广泛使用.虽然Access提供了可视化的操作方法,但许多开发人员还是喜欢直接用SQL语句操作数据表.如何在Access中打开SQL视图,对于初次使用Access的程序 ...

  3. access中case替代方法

    access中case替代方法 SELECT UserPassportID as PassportID, UserID, GrantorID, Case ObjectTypeID When 1 the ...

  4. Access中的SELECT @@IDENTITY

    在Access数据库中存在select @@identity吗?答案是肯定的.但是Access一次只能执行一条SQL,多条SQL需要多次执行,这是限制.在SQL Server中,可以一次执行多条SQL ...

  5. 总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法

    总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法以 及SQL语句中日期格式的表示(#).('') 在Delphi中进行字符变量连接相加时单引号用( ...

  6. (转载)总结一下SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法...

    总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法 总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中 ...

  7. SQL语句中引号(')、quotedstr()、('')、format()在SQL语句中的用法

    总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的用法总结一下SQL语句中引号(').quotedstr().('').format()在SQL语句中的 ...

  8. access调整字段顺序_Microsoft Access中的顺序行

    access调整字段顺序 This is the second article on row numbers in Microsoft Access. 这是有关Microsoft Access中行号的 ...

  9. mysql中groupby用法_详解SQL中GroupBy的用法

    GROUP BY 语句用于结合合计函数,根据一个或多个列对结果集进行分组. 1.概述 "Group By"从字面意义上理解就是根据"By"指定的规则对数据进行分 ...

最新文章

  1. Jenkins配置MSBuild实现自动部署(MSBuild+SVN/Subversion+FTP+BAT)
  2. JAVA虚拟机体系结构
  3. Java集合框架一览笔录
  4. libsvm工具箱会和matlab,MATLAB实现多分类和libsvm工具箱的安装使用详解
  5. 【python 2】python 进阶
  6. 我是如何寻找数据集的,一些个人私藏
  7. 1621: [Usaco2008 Open]Roads Around The Farm分岔路口(记忆化搜索)
  8. matlab状态转空间,matlab - 如何在Matlab中使用状态空间模型避免tf()命令 - 堆栈内存溢出...
  9. 二分查找的代码实现--go语言
  10. cplex java_线性最优解java实现+Cplex java调用
  11. mysql三表联合查询_求三表联合查询的SQL查询语句
  12. win2012R2无法打开匿名级安全令牌,安装.net 3.5
  13. 基于IBM Tivoli TSM系统构建某局备份系统实施方案
  14. 如何在google隐藏页面_如何在Google文档中隐藏或删除评论
  15. 第八周--项目1--实现复数类中的运算符重载
  16. 查看自己电脑的开关机记录
  17. 服务调用追踪工具skywalking实践
  18. 算法学习:我终于明白二分查找的时间复杂度为什么是O(logn)了
  19. 打开用友软件提示 SQL Server口令怎么办?(含多种版本SQL Server数据库的安装方法)
  20. Java毕业设计——基于SSM的图书馆座位预约管理系统占座系统 / java图书馆座位预约管理系统占座系统

热门文章

  1. 【C++探索之旅】第一部分第十二课:指针一出,谁与争锋
  2. SOFA Weekly | Layotto 本周新晋 Contributor、QA 整理、新手任务
  3. 近万米展厅,压箱底的宝贝,雪浪大会最好玩的黑科技都在这了 | 倒计时1天
  4. ansible中的角色使用--nginx+持续交付和滚动升级+时间同步角色+selinux+自动添加磁盘
  5. 对反正弦函数的泰勒公式的转换加速
  6. 12306能删候补订单记录_12306“候补购票”今日上线 一个订单可添加4个候补需求...
  7. lol那个服务器有无限火力,2018LOL国服无限火力什么时候开放
  8. 将文件夹与svn断开,消除绿色对勾或红色感叹号
  9. 堆转储上的线程:_妖精陷阱:线程转储分析模式
  10. [量化-017]防雷