DataSet = new DataSet(); ds = DataSetObject; DataTable dt1,dt2,dt3; dt1 = ds.Tables[0]; //*** Or Tables("table-name") ***// dt2 = ds.Tables[1]; //*** Or Tables("table-name") ***// dt3 = ds.Tables[2]; //*** Or Tables("table-name") ***//
System.Data.OleDb.OleDbConnection objConn = new System.Data.OleDb.OleDbConnection(); System.Data.OleDb.OleDbCommand objCmd = new System.Data.OleDb.OleDbCommand(); System.Data.OleDb.OleDbDataAdapter dtAdapter = new System.Data.OleDb.OleDbDataAdapter(); DataSet ds = new DataSet(); DataTable dt; String strConnString,strSQL; strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("database/mydatabase.mdb")+";Jet OLEDB:Database Password=;"; strSQL = "SELECT * FROM customer"; objConn.ConnectionString = strConnString; objCmd.Connection = objConn; objCmd.CommandText = strSQL; objCmd.CommandType = CommandType.Text; dtAdapter.SelectCommand = objCmd; dtAdapter.Fill(ds); dt = ds.Tables[0]; //*** DataTable ***// dtAdapter = null; objConn.Close(); objConn = null;
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท