sinat_25045939 2015-01-04 13:49 采纳率: 66.7%
浏览 3656
已采纳

错误 1 “UpdateDataBase”方法没有任何重载采用“1”个参数

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 进销存管理系统
{
public partial class PopedomManage : Form
{
private DataSet ds = new DataSet();
private LinkDataBase link = new LinkDataBase();
private string sendTableName = "用户清单";
private string sendStrSQL = "SELECT * from 用户清单 where 姓名<>'sys'";
private DataTable popedomDataTable = new DataTable();
private bool blInitial = true;

    public PopedomManage()
    {
        InitializeComponent();
    }
    private void PopedomManage_Load(object sender, System.EventArgs e)

{
this.ds = this.link.SelectDataBase(sendStrSQL, sendTableName);

      this.dgrd_Popedom.DataSource = ds.Tables[0];
    this.DataGridStateControl();
    this.dgrd_Popedom.Select();

    string selectedUserID= this .ds.Tables [0].Rows [0][0].ToString ();

    string tempStrSQL= "select 权限名称 from 权限名单 " + " where 用户编号 = '" +
        selectedUserID + "'";
    popedomDataTable=link.SelectDataBase(tempStrSQL);
    for (int i=0;i<popedomDataTable.Rows.Count;i++)
{
for (int j=0;j<this.chkLst_Priority.Items.Count;j++)
{
if (this.chkLst_Priority.Items[j].ToString().Trim()==popedomDataTable.
    Rows[i][0].ToString().Trim())
{
this.chkLst_Priority.SetItemChecked(j,true);
       }
    }
}

}

    private void DataGridStateControl()
    {
        DataGridTableStyle ts = new DataGridTableStyle();
        ts.AlternatingBackColor = Color.LightGray;
        ts.MappingName = this.ds.Tables[0].TableName;
        ts.AllowSorting = false;
        int numCols = this.ds.Tables[0].Columns.Count;
        this.dgrd_Popedom.TableStyles.Add(ts);
    }

    private void chkLst_Priority_ItemCheck(object sender, System.Windows.Forms.ItemCheckEventArgs e)

{

if (blInitial == false)
{
if (e.CurrentValue.ToString()=="Unchecked")
{
try
{

   string strUserName = this.dgrd_Popedom[this.dgrd_Popedom.CurrentCell.

RowNumber,0].ToString().Trim();
string strPopedom = this.chkLst_Priority.SelectedItem.ToString();
string temSendStrSQL = "insert 权限清单(用户编号,权限名称)values ('" + strUserName+"','" + strPopedom+"')";

     this.link.UpdateDataBase(temSendStrSQL);

}
catch
{
MessageBox.Show("数据库中的权限修改出错,请重试!","信息");

}

}

 else if (e.CurrentValue.ToString()=="Chencked")
            {
                try 
                {
                    string strUserName =  this.dgrd_Popedom[this.dgrd_Popedom.CurrentCell.
            RowNumber,0].ToString().Trim();
                    string strPopedom =this.chkLst_Priority.SelectedItem.ToString();
                    string tempSendStrSQL= " delete from 权限清单 where (用户编号 = '" + 
            strUserName + "'" + "and 权限清单 = '" + strPopedom + "')";
                    this.link.UpdateDataBase ( tempSendStrSQL );
                }
                catch 
                {
                    MessageBox.Show("数据库中的权限修改出错!","信息");
                }
            }
        }
}
    private void dgrd_Popedom_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)

{
if (this.dgrd_Popedom.CurrentCell.RowNumber >= this.ds.Tables[0].Rows.Count)
//防止出现所选的用户不再数据表中的情况
{
return;
}
this.chkLst_Priority.Enabled=true;
blInitial=true; //控制当"权限管理"窗体刚生成时和单击其他用户时使

//CheckedListBox控件中数据发生改变时不响应ItemCheck事件
//以下代码实现的是当DataGrid中所选用户改变时,根据所选用户重新设置ListBox的
//功能
for(int i=0;i< this.chkLst_Priority.Items.Count;i++)
                                                 //将ListBox中所用权限设为未选中
{
    this.chkLst_Priority.SetItemChecked(i,false);
}
int intRowNumber =this.dgrd_Popedom.CurrentCell.RowNumber;
string selectedUserID =this.ds.Tables[0].Rows[intRowNumber][0].ToString();
string tempStrSQL= " select 权限名称 from 权限清单 " + " where 用户编号 = '" +

selectedUserID + "'";
popedomDataTable=link.SelectDataBase(tempStrSQL); //查询所选用户权限
for(int i=0;i<popedomDataTable.Rows.Count;i++) //重新设置ListBox
{
for(int j=0;j<this.chkLst_Priority.Items.Count;j++)
{
if(this.chkLst_Priority.Items[j].ToString().Trim()==popedomDataTable.
Rows[i][0].ToString().Trim())
{
this.chkLst_Priority.SetItemChecked(j,true);
}
}
}

blInitial=false;

}
}
}

  • 写回答

4条回答 默认 最新

  • threenewbee 2015-01-04 13:58
    关注

    你可以在UpdateDataBase上面点右键,然后点转到定义。把UpdateDataBase的定义贴出来。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!