1、
连接Oracle,并可以将数据库的数据显示在 GridControl上
string ConnectionString = "Data Source=数据库名;User Id=用户名;Password=密码;Integrated Security=no;"; OracleConnection conn=new OracleConnection(ConnectionString); conn.Open(); OracleCommand cmd = new OracleCommand("select * from FY", conn); OracleDataAdapter oda = new OracleDataAdapter(); oda.SelectCommand = cmd; DataSet ds = new DataSet(); oda.Fill(ds); gridControl1.DataSource = ds.Tables[0].DefaultView; conn.Close();
2、修改
string ConnectionString = "DataSource=数据库名称;User Id=数据库登陆名;Password=密码;Integrated Security=no;"; OracleConnection conn=new OracleConnection(ConnectionString); conn.Open(); string str = "SQL修改语句'"; //当不传递conn时,会提示连接没有打开 OracleCommand cmd1 = newOracleCommand(str,conn); //ExecuteNonQuery()对于 Update,Insert,Delete 语句执行成功是返回值为该命令所影响的行数 int result=cmd1.ExecuteNonQuery();
3、