private void Page_Load (object sender, System.EventArgs e) {// here placed in user code to initialize the page string ConnectionString = "Data Source = luxuezhu; user = system; password = manager;"; // write connection string OracleConnection conn = New OracleConnection (Connectionstring); // Create a new connection OracleDataadapter Da = New OracleDataAdapter ("Select * from Scott.emp", Conn; DataSet DS = New DataSet (); Da.Fill (DS); DataGrid1.DataSource = DS; DATAGRID1.DATABIND ();
} At the beginning of the program, you need to pay attention to: 1. The program starts to add Using System.Data.OracleClient; 2, SQLConnection / SqlDataAdapter must be changed to Oracle; 3, "Select * from scott.emp".