首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#初学者,winForm 有关问题

2013-03-13 
C#菜鸟求助,winForm 问题using Systemusing System.Collections.Genericusing System.ComponentModelus

C#菜鸟求助,winForm 问题
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace StuffWorkManage
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        SqlConnection conn;
        private void Form1_Load(object sender, EventArgs e)
        {
            conn = new SqlConnection("server=.;database=StuffDB;integrated security=SSPI");
            Load();
        }
        public DataSet getds(String sql)
        {
            try
            {
                SqlCommand cmd = new SqlCommand(sql, conn);
                SqlDataAdapter sda = new SqlDataAdapter();
                sda.SelectCommand = cmd;
                DataSet ds = new DataSet();
                sda.Fill(ds);
                cmd.Dispose();
                return ds;
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
                return null;
            }

        }
        public void ExecuteSql(String sql)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = conn;
            cmd.CommandText = sql;
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();


        }
        public void Load()
        {
            String sql = "select s.StuID as'员工号',s.StuName as '员工姓名',s.StuLocation as '所在地' from StuR s";
            DataSet ds = getds(sql);
            dataGridView4.DataSource = ds.Tables[0];
            ds.Dispose();
        } 



错误信息:错误2“Load”是一个“方法组”,无法为它赋值 


不知道这是什么问题呢?求大神指导
[解决办法]
 public void Load()
=>
 public void load()

热点排行