using System; using System.Data; using System.Data.OleDb ;
class connect{ public static void Main(){ try { string strCon=" Provider=SQLOLEDB.1 ; Persist Security Info=False ; User ID = sa ; password=198066;Initial Catalog=CESHI ; Data Source = JP-DXYW-YUXF " ; OleDbConnection myConn=new OleDbConnection(strCon);
string strCom="SELECT * FROM aaaaaa where shcool=123" ; myDataSet = new DataSet(); myConn.Open();
//OleDbDataAdapter得到一个数据集
OleDbDataAdapter myCommand=new OleDbDataAdapter(strCom,myConn);
//把Dataset绑定person数据表
myCommand.Fill(myDataSet,"person");
//关闭此OleDbConnection myConn.Close(); myBind=this.BindingContext[myDataSet,"person"]; } catch(Exception e) { Console.WriteLine("Welcome to you!"); } } }
编译时老出错,是什么原因???
25.cs(13,1): error CSo103 :the name 'myDataSet' does not exist in the class or namespace'connect'