zoukankan      html  css  js  c++  java
  • Use SqlDataAdapter to update database, but SqlCommandBuilder required

                SqlDataAdapter da = new SqlDataAdapter();
               SqlCommand cmd = new SqlCommand("select * from t_upload", conn);
               da.SelectCommand = cmd;
             
               SqlCommandBuilder cb = new SqlCommandBuilder(da);

               DataSet ds = new DataSet();
               da.Fill(ds, "upload");
               DataRow newrow = ds.Tables[0].NewRow();
               newrow["filesize"] = filesize;
               newrow["filename"] = filename;
               newrow["filecontent"] = content;
               ds.Tables[0].Rows.Add(newrow);
               fs.Close();
               da.Update(ds, "upload");
               conn.Close();

  • 相关阅读:
    什么是Java
    程序有问题解决方法
    面向对象三大特征
    实例变量和局部变量
    内存管理
    常见面试题(更新中)
    多态
    设计规则
    内部类
    编程英语
  • 原文地址:https://www.cnblogs.com/Winston/p/1026484.html
Copyright © 2011-2022 走看看