日期:2014-05-17  浏览次数:20735 次

各位大哥帮忙给看一下以下代码有什么错误
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace zicai
{
    public partial class zucai : Form
    {
        OleDbConnection objConnection;
        OleDbCommand sqlcmd1,sqlcmd2;
        OleDbCommand sqlInsert,sqlUpdate;
        OleDbDataReader reader,reader1;
        String dateTime = null;
        public zucai()
        {
            InitializeComponent();
            connAccess();
        }

        private void butStart_Click(object sender, EventArgs e)
        {
            ReadData();
        }

        public Boolean connAccess()
        {
            Boolean status = false;
            string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
            strConnection += @"Data Source=//127.0.0.1//access//zicai.mdb";
             try
             {
                 objConnection = new OleDbConnection(strConnection);  //建立连接  
                 objConnection.Open();  //打开连接
                 MessageBox.Show("连接成功");
             }catch(Exception ex)
             {
                 MessageBox.Show("Conncection:"+ex.Message);
             }
            
            return status;
        }
        public Boolean ReadData()
        {
            //String insertStr = null;
            Boolean status = false;
            //in