| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 453 人关注过本帖
标题:标准表达式中数据类型不匹配的问题!button3函数有点问题执行不出结果!
只看楼主 加入收藏
迷上编程
Rank: 2
等 级:论坛游民
帖 子:140
专家分:86
注 册:2012-3-11
结帖率:83.33%
收藏
已结贴  问题点数:20 回复次数:1 
标准表达式中数据类型不匹配的问题!button3函数有点问题执行不出结果!
程序代码:
using System;
using System.Collections.Generic;
using  System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data.SqlClient;
namespace _621007_赵武青
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
        }
        private void button1_Click(object sender, EventArgs e)
        {
            OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/" + "DB.mdb");
            aConnection.Open();
            OleDbDataAdapter myadapter = new OleDbDataAdapter("select * from jidian", aConnection);
            DataSet ds = new DataSet();
            myadapter.Fill(ds);
            dataGridView1.DataSource = ds.Tables[0];//将dataGridView1与ds中的内容连接起来
        }
        private void button2_Click(object sender, EventArgs e)
        {
            OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/" + "DB.mdb");
            aConnection.Open();
            string strName;
            strName = "insert into jidian(dianhao,X,Y,Z) values(" + textBox1.Text + ",'" + textBox2.Text + "','" + textBox3.Text + "'," + textBox4.Text + ")";
            if (textBox1.Text == "" | textBox2.Text == "" | textBox3.Text == "" | textBox4.Text == "")
            {
                  MessageBox.Show("请填写要添加的数据");
                  return ;
            }
            OleDbDataAdapter myadapter = new OleDbDataAdapter(strName, aConnection); //执行查询
            DataSet ds = new DataSet(); //新建数据集
            myadapter.Fill(ds);//将SQL执行结果,填入数据集ds中可自加数据,进行验证
        }
        private void button3_Click(object sender, EventArgs e)
        {
            OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/" + "DB.mdb");
            aConnection.Open();
            string strName;
            strName = "delete from jidian where dianhao=" + textBox1.Text;
            if (textBox1.Text == "")
            {
                MessageBox.Show("请输入点号");
                return;
            }
            OleDbDataAdapter myadapter = new OleDbDataAdapter(strName, aConnection);
            DataSet ds = new DataSet();
            myadapter.Fill(ds);        ///错误是标准表达式中数据类型不匹配。
        }
        private void button4_Click(object sender, EventArgs e)
        {
            OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/" + "DB.mdb");
            aConnection.Open();
            OleDbDataAdapter myadapter = new OleDbDataAdapter("select * from celiang", aConnection);
            DataSet ds = new DataSet();
            myadapter.Fill(ds);
            dataGridView1.DataSource = ds.Tables[0];//将dataGridView1与ds中的内容连接起来
        }
        private void textBox7_TextChanged(object sender, EventArgs e)
        {
        }
        private void button5_Click(object sender, EventArgs e)
        {
            OleDbConnection aConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + "/" + "DB.mdb");
            aConnection.Open();
            string strName;
            strName = "insert into celiang(dianhao,测X,测Y,测Z) values(" + textBox5.Text + ",'" + textBox6.Text + "','" + textBox7.Text + "'," + textBox8.Text + ")";
            if (textBox5.Text == "" | textBox6.Text == "" | textBox7.Text == "" | textBox8.Text == "")
            {
                MessageBox.Show("请填写要添加的数据");
                return;
            }
            OleDbDataAdapter myadapter = new OleDbDataAdapter(strName, aConnection); //执行查询
            DataSet ds = new DataSet(); //新建数据集
            myadapter.Fill(ds);//将SQL执行结果,填入数据集ds中可自加数据,进行验证
        }
    }
}
搜索更多相关主题的帖子: void private 表达式 
2012-12-18 18:56
mpi
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:5
帖 子:99
专家分:872
注 册:2012-11-14
收藏
得分:20 
上次给过你答案了哦,你这条问题重复好多次了。

厌烦自私贪婪和不劳而获的人。
厌烦代码各种求,而不思进取的人。
本人也是菜鸟,求上进,踏实不浮躁的朋友共同进步。
2012-12-25 10:57
快速回复:标准表达式中数据类型不匹配的问题!button3函数有点问题执行不出结果 ...
数据加载中...
 
   



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

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