1 / 6

Browser (Client Side) 瀏覽器 ( 客戶端 )

Browser (Client Side) 瀏覽器 ( 客戶端 ). DataGridView. TextBox , MsgBox. DataSet ( DataTable ). DataReader. DataAdapter 1. SelectCommand 2. InsertCommand 3. UpdateCommand 4. DeleteCommand. Command. Connection. DataBase 資料庫. Connection  DataAdapter  DataSet  DataGridView.

darryl
Download Presentation

Browser (Client Side) 瀏覽器 ( 客戶端 )

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Browser (Client Side) 瀏覽器 (客戶端) DataGridView TextBox, MsgBox DataSet (DataTable) DataReader DataAdapter 1. SelectCommand 2. InsertCommand 3. UpdateCommand 4. DeleteCommand Command Connection DataBase資料庫

  2. Connection  DataAdapter DataSet DataGridView using System.Data; using System.Data.OleDb; OleDbConnectionconnection1 = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=battles.mdb;"); connection1.Open(); OleDbDataAdapteroleDbDataAdapter1 = new OleDbDataAdapter(); DataSetds = new DataSet(); String s = "select * from ships"; oleDbDataAdapter1.SelectCommand= new OleDbCommand (s, connection1); oleDbDataAdapter1.Fill(ds); 1 DataGriddataGridView1 = new DataGridView(); dataGridView1.DataSource= ds.Tables["ships"]; 2 DataGriddataGrid1 = new DataGrid(); dataGrid1.DataSource= ds; dataGrid1.CaptionText= "Ships";

  3. Connection  Command DataReader TextBox using System.Data; using System.Data.OleDb; OleDbConnectionconnection1 = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=battles.mdb;"); connection1.Open(); String s = "select * from ships"; OleDbCommandcmd = new OleDbCommand(s, connection1); OleDbDataReaderreader = cmd.ExecuteReader(); for(i=0; i<reader.FieldCount(); i++) textBox1.Text += reader.GetName(i) + "\t"; // field name textBox1.Text += Environment.NewLine; while( reader.Read() ){ // ~fgets for(i=0; i<reader.FieldCount(); i++) textBox1.Text += reader.GetValue(i) + "\t"; // data textBox1.Text += Environment.NewLine; } textBox1.Text = reader["country"].ToString();

  4. Connection  Command DataReader TextBox using System.Data; using System.Data.OleDb; OleDbConnectionconnection1 = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=battles.mdb;"); connection1.Open(); String s = "insert into ships values ('A','shipA')"; OleDbCommandcmd = new OleDbCommand(s, connection1); OleDbDataReaderreader = cmd.ExecuteNonQuery(); String s = "update ships set ship='shipB' where ship='shipA'"; OleDbCommandcmd = new OleDbCommand(s, connection1); OleDbDataReaderreader = cmd.ExecuteNonQuery(); String s = "delete from ships where country='A'"; OleDbCommandcmd = new OleDbCommand(s, connection1); OleDbDataReaderreader = cmd.ExecuteNonQuery();

  5. OleDbCommandcmd = connection1.CreateCommand(); try { cmd.CommandText= "drop table temp;"; cmd.ExecuteNonQuery(); } catch (Exception ex) { }

More Related