易截截图软件、单文件、免安装、纯绿色、仅160KB

Access数据操作Update方法

using System.Data.OleDb; //这里要引用OleDb空间
public partial class addInfo : System.Web.UI.Page
{
    //数据库连接字符串
    static string strCon = @"provider = Microsoft.Jet.OLEDB.4.0;Data source = |DataDirectory|gyMDB.mdb";
    //以上方法为连接ACCESS 特定数据目录APP_DATA 下数据文件的方法。注意DATADIRECTORY 的使用。
    //申明连接数据源的对象和对数据源进行操作的对象
    OleDbConnection con = new OleDbConnection(strCon);
    OleDbCommand cmd = new OleDbCommand();
    //点击按钮添加记录
    protected void Page_Load(object sender, EventArgs e)
    {
        TextBox11.ReadOnly = false;
        TextBox11.Text = "这是学号";
        TextBox11.ReadOnly = true;
        TextBox12.Text = "这是准考证号";
        TextBox13.Text = "这是姓名";
        if (!Page.IsPostBack) { }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
      
        string A0 = TextBox11.Text; //0.学号
        string A1 = TextBox12.Text; //1.准考证号
        string A2 = TextBox13.Text; //2.姓名
        string A3 = DropDownList1.Text; //3.小学入学年月
        string A4 = DropDownList2.Text; //4.班号
        string A5 = DropDownList3.Text; //5.学生类别
        string A6 = TextBox1.Text.Trim(); //6.身份证号
        string A7 = DropDownList4.Text; //7.性别
  


相关文档:

access数据库插入更新出错

今天谈两个ASP运行时可能出现的与IIS有关的错误
-------------------------------------------------------------------
错误类型一:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] 不能更新。数据库或对象为只读。
错误类型二:
Microsoft OLE DB Provider ......

关于update语句在sqlserver和Access中的对比

sqlserver:update Table_A set Table_A.col1 = (select Table_B.col1 from Table_B where Table_A.col2 = Table_B.col2)
Access: UPDATE Table_ A, Table_B SET Table_ A.字段2 = Table_ B.字段2
WHERE Table_ A.编号=Table_ A.编号;
自己记下,提醒自己 ......

获取Access用户定义的表名和各表的字段名

 public   static  DataTable GetSchemaTable(string connectionString)  //获取Access所有的表名;
        {
            using (OleDbConnection connection = new
    &n ......

利用 DataGridView 绘制图片列表(从Access读取图片)

using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Microsoft.Win32;
using Access = Microsoft.Office.Interop.Access;
namespace ImageAccess
{
    static class Program
    {
   ......

关于Access和Excel的连接字符串

1.连接Access的连接字符串
string strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + @FileName;
2.连接Excel
string strExcel = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + @FileName + ";Extended Properties=Excel 8.0;"; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号