| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1654 人关注过本帖
标题:说adb.Fill(ds, "specialty");至少有一个参数没有被指定是什么意思!! ...
只看楼主 加入收藏
冰冷
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-5-9
收藏
 问题点数:0 回复次数:8 
说adb.Fill(ds, "specialty");至少有一个参数没有被指定是什么意思!!
如题  先谢大家

[[it] 本帖最后由 冰冷 于 2008-5-10 08:58 编辑 [/it]]
搜索更多相关主题的帖子: specialty adb Fill 参数 quot 
2008-05-09 16:02
冰冷
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-5-9
收藏
得分:0 
怎么没人呢!!!急救!!
2008-05-09 16:27
drychq
Rank: 1
等 级:新手上路
帖 子:114
专家分:0
注 册:2007-10-30
收藏
得分:0 
前面 的那 部分代码 了....
2008-05-09 17:10
冰冷
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-5-9
收藏
得分:0 
回复 3# 的帖子
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;


namespace 学生专业管理系统
{
    public partial class BrowseSpecialty : Form
    {
        public BrowseSpecialty()
        {
            InitializeComponent();
        }

        OleDbConnection connection1 = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=E:\\学生专业管理.mdb");

        //定义数据集对象ds用于保存查询专业信息返回的结果集
        DataSet ds;

        //在窗口的初始化事件中,对dataGrid1进行绑定
        private void BrowseSpecialty_Load(object sender, EventArgs e)
        {
            connection1.Open();
            string sql = "select specialtyid as  编号,specialtyname as 专业名称,remark as 专业描述 from specialtyinfo";
            OleDbDataAdapter adb = new OleDbDataAdapter(sql, connection1);
            ds = new DataSet();
    0 ------ adb.Fill(ds, "specialty");----------
            dataGrid1.DataSource = ds.Tables[0].DefaultView;
        }
        //当dataGrid1中当前单元格发生变化时,将对应的专业名称显示在dataGrid1的标题中
        private void dataGrid1_CrrentCellChanged(object sender, EventArgs e)
        {
            dataGrid1.CaptionText = dataGrid1[dataGrid1.CurrentRowIndex, 1].ToString();
        }

        //点击修改按钮(button1)时,调用ModifySpecialty窗体
        private void button1_Click(object sender, EventArgs e)
        {
            ModifySpecialty modifySpecialty;
            if (dataGrid1[dataGrid1.CurrentCell] != null)
            {
                modifySpecialty = new ModifySpecialty();
                modifySpecialty.textBox1.Text = ds.Tables[0].Rows[dataGrid1.CurrentRowIndex][0].ToString().Trim();
                //获得专业编号
                modifySpecialty.textBox2.Text = ds.Tables[0].Rows[dataGrid1.CurrentRowIndex][1].ToString().Trim();
                //获得专业名称
                modifySpecialty.richTextBox1.Text = ds.Tables[0].Rows[dataGrid1.CurrentRowIndex][2].ToString().Trim();
                //获得专业描述
                modifySpecialty.ShowDialog();
                //生成新窗体
            }
        }

        //删除按钮事件
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGrid1[dataGrid1.CurrentCell] != null)
            {
                string sql = "select specialtyname from specialtyinfo where specialtyid=" + ds.Tables["specialty"].Rows[dataGrid1.CurrentCell.RowNumber][0].ToString().Trim() + "and specialtyid not in (select distinct specialtyinfo.specialtyid from classinfo inner join specialtyinfo on classinfo.specialtyname=specialtyinfo.specialtyname)";
                OleDbCommand cmd = new OleDbCommand(sql, connection1);
                OleDbDataReader dr;
                dr = cmd.ExecuteReader();
                if (!dr.Read())
                {
                    MessageBox.Show("删除专业'" + ds.Tables["specialty"].Rows[dataGrid1.CurrentCell.RowNumber][1].ToString().Trim() + "'失败,请先删除与此专业相关的班级", "提示");
                    dr.Close();
                }
                else
                {
                    dr.Close();
                    sql = "delete * from specialtyinfo where specialtyname not in (select distinct specialtyname from classinfo) and specialtyid=" + ds.Tables["specialty"].Rows[dataGrid1.CurrentCell.RowNumber][0].ToString().Trim();
                     = sql;
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("删除专业'" + ds.Tables["specialty"].Rows[dataGrid1.CurrentCell.RowNumber][1].ToString().Trim() + "'成功", "提示");
                }
            }
        }
        
        //退出
        private void button3_Click(object sender, EventArgs e)
        {
            this.Close();
        }

         private void dataGrid1_CurrentCellChanged(object sender, EventArgs e)
        {
            dataGrid1.CaptionText = dataGrid1[dataGrid1.CurrentRowIndex, 1].ToString();
        }        
        }

    }
2008-05-09 17:25
hebingbing
Rank: 6Rank: 6
来 自:黄土高坡
等 级:贵宾
威 望:27
帖 子:3417
专家分:371
注 册:2007-10-22
收藏
得分:0 
你把“编号”这些换成英文呢?……
2008-05-09 18:28
冰冷
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-5-9
收藏
得分:0 
回复 5# 的帖子
string sql = "select specialtyid as  编号,specialtyname as 专业名称,remark as 专业描述 from specialtyinfo



as  前面就是它们对应的英文
2008-05-10 08:24
冰冷
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-5-9
收藏
得分:0 
那位高手指點一下!謝謝!
2008-05-10 09:59
feel7882
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-16
收藏
得分:0 
指定的表名称是不是不一至
2008-06-18 11:32
feel7882
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2008-6-16
收藏
得分:0 
fill填充的表应该跟select。。。from的表名一致。
2008-06-18 11:34
快速回复:说adb.Fill(ds, "specialty");至少有一个参数没有被指定是什么意思!! ...
数据加载中...
 
   



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

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