c#问题,求大神jie'dao
usingSystem;usingSystem.Drawing;usingSystem.ComponentModel;usingSystem.Windows.Forms;...
using System;
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data;
public class DataView : Form
{
private System.ComponentModel.Container components;
private Button lastrec;
private Button nextrec;
private Button previousrec;
private Button firstrec;
private TextBox t_books;
private TextBox t_bookprice;
private TextBox t_bookauthor;
private TextBox t_booktitle;
private TextBox t_bookid;
private Label l_books;
private Label l_bookprice;
private Label l_bookauthor;
private Label l_booktitle;
private Label l_bookid;
private Label label1;
private GroupBox GroupBox1;
private StatusBar statusbar;
private System.Data.DataSet myDataSet;
private BindingManagerBase myBind;
public DataView()
{
GetConnected();
InitializeComponent();
}
protected override void Dispose()
{
base.Dispose();
components.Dispose();
}
public static void Main()
{
Application.Run(new DataView());
}
public void GetConnected()
{
try
{
string strCon = " Provider =Microsoft.Jet.OLEDB.4.0; Data Source = d:\\book2.mdb";
OleDbConnection myConn = new OleDbConnection(strCon);
string strCom = " SELECT * FROM bookstock";
myDataSet = new DataSet();
myConn.Open();
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, myConn);
myCommand.Fill(myDataSet, "bookstock");
myConn.Close();
}
catch (Exception e)
{
MessageBox.Show(" 连接错误! " + e.ToString(), "错误");
}
}
错误 1 程序“D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\obj\x86\Debug\WindowsFormsApplication4.exe”定义了不止一个入口点:“WindowsFormsApplication4.Program.Main()”。请使用 /main 进行编译,以指定包含入口点的类型。 D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\Program.cs 14 21 WindowsFormsApplication4
错误 2 “WindowsFormsApplication4.DataView.Dispose(bool)”: 没有找到适合的方法来重写 D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\Form1.Designer.cs 14 33 WindowsFormsApplication4
错误 3 “DataView.Dispose()”: 当重写“public”继承成员“System.ComponentModel.Component.Dispose()”时,无法更改访问修饰符 D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\Form1.cs 36 29 WindowsFormsApplication4
错误 4 “DataView.Dispose()”: 继承成员“System.ComponentModel.Component.Dispose()”未标记为 virtual、abstract 或 override,无法进行重写 D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\Form1.cs 36 29 WindowsFormsApplication4
求大神解答上面出现的问题 展开
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data;
public class DataView : Form
{
private System.ComponentModel.Container components;
private Button lastrec;
private Button nextrec;
private Button previousrec;
private Button firstrec;
private TextBox t_books;
private TextBox t_bookprice;
private TextBox t_bookauthor;
private TextBox t_booktitle;
private TextBox t_bookid;
private Label l_books;
private Label l_bookprice;
private Label l_bookauthor;
private Label l_booktitle;
private Label l_bookid;
private Label label1;
private GroupBox GroupBox1;
private StatusBar statusbar;
private System.Data.DataSet myDataSet;
private BindingManagerBase myBind;
public DataView()
{
GetConnected();
InitializeComponent();
}
protected override void Dispose()
{
base.Dispose();
components.Dispose();
}
public static void Main()
{
Application.Run(new DataView());
}
public void GetConnected()
{
try
{
string strCon = " Provider =Microsoft.Jet.OLEDB.4.0; Data Source = d:\\book2.mdb";
OleDbConnection myConn = new OleDbConnection(strCon);
string strCom = " SELECT * FROM bookstock";
myDataSet = new DataSet();
myConn.Open();
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, myConn);
myCommand.Fill(myDataSet, "bookstock");
myConn.Close();
}
catch (Exception e)
{
MessageBox.Show(" 连接错误! " + e.ToString(), "错误");
}
}
错误 1 程序“D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\obj\x86\Debug\WindowsFormsApplication4.exe”定义了不止一个入口点:“WindowsFormsApplication4.Program.Main()”。请使用 /main 进行编译,以指定包含入口点的类型。 D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\Program.cs 14 21 WindowsFormsApplication4
错误 2 “WindowsFormsApplication4.DataView.Dispose(bool)”: 没有找到适合的方法来重写 D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\Form1.Designer.cs 14 33 WindowsFormsApplication4
错误 3 “DataView.Dispose()”: 当重写“public”继承成员“System.ComponentModel.Component.Dispose()”时,无法更改访问修饰符 D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\Form1.cs 36 29 WindowsFormsApplication4
错误 4 “DataView.Dispose()”: 继承成员“System.ComponentModel.Component.Dispose()”未标记为 virtual、abstract 或 override,无法进行重写 D:\大作业\WindowsFormsApplication4\WindowsFormsApplication4\Form1.cs 36 29 WindowsFormsApplication4
求大神解答上面出现的问题 展开
1个回答
展开全部
你是不是copy代码copy错了,这个
protected override void Dispose()
{
base.Dispose();
components.Dispose();
}
public static void Main()
{
Application.Run(new DataView());
}
怎么会在这个类里面呢,删掉试试
protected override void Dispose()
{
base.Dispose();
components.Dispose();
}
public static void Main()
{
Application.Run(new DataView());
}
怎么会在这个类里面呢,删掉试试
追问
请问是只删掉
public static void Main()
{
Application.Run(new DataView());
}
这些吗
追答
这些
protected override void Dispose()
{
base.Dispose();
components.Dispose();
}
public static void Main()
{
Application.Run(new DataView());
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询