??xml version="1.0" encoding="utf-8" standalone="yes"?> A colleague recently asked me a question: "I'm modifying the data type of a column. When doing so I get the following error: ORA-54033: column to be modified is used in a virtual column expression But there's no virtual columns defined on the table! What on earth's going on?!" This was exceptionally confusing. Looking at the table definition we couldn't see any virtual columns defined: Sure enough, when we tried to change the data type of y we got the exception: How could this be? Perhaps there was a column defined that we couldn't see. Querying user_tab_cols revealed something interesting: The SYS_... column isn't in the table DDL! Where does it come from? And what's SYS_OP_COMBINED_HASH all about? Has someone been mucking around with the database? The SYS_ prefix is a sign that the column is system generated. So something's happened that's caused Oracle to create this on our behalf. SYS_OP_COMBINED_HASH is an undocumented feature. The name implies Oracle is merging the arguments together to form a hash. Is there a feature where we want to capture information about a group of columns? Indeed there is -extended statistics!This feature enables to Oracle calculate statistics on a group of columns. It uses this information to improve row estimates. This is useful when there's a correlation between the values of two (or more) columns in a table. Someone had created extended stats on this table for (x, y). Now we've identified the problem, how do we get around it? Simple: drop and recreate the extended stats: Success! Extended stats are a great way to improve the optimizer's row estimates. If you need to create these, I recommend you also do the following: Ҏ一Q?/p>
Ҏ二: Easyui Tree一直就没有提供q个Ҏ,以前没有用到,所以一直没怎么在意,q次自己用到?Z扩展了一个方?分nl大? 十进?->十六q制 十六q制-->十进?br />select to_number('7D','XX') from dual; 参数默认值是指在调用函数Ӟ若省略了某个实参Q函C自动参数分配一个默认|使得函数调用的方便性和灉|性大大提高?/p>
举个例子Q比?a style="color: rgb(51,51,51); font-size: 14px; text-decoration: none" class="keylink" target="_blank">PHP中的字符串截取函数substr(string,start,length)Q当不指定lengthӞ函数默认截取字W串中start位置到字W串l束Q而如果指定了lengthQ则截取从start位置开始的以length为长度的字符Ԍ所以如果调用的是substr('http://www.hualai.net.cn',11,6)Q则q回的是hualaiQ如果省略掉最后一个参敎ͼsubstr('http://www.hualai.net.cn',11)Q则q回hualai.net.cn?/p>
再比如jQuery框架中,$(selector).html()Ҏ是获取该元素内的HTML代码Q?(selector).html(content)则是讄该元素内的HTML。我们知道,在C语言中,我们可以通过如下形式来ؓ函数参数讄默认| [cpp] [java] [js] [js] [js] 感觉q个CTE递归查询蛮好用的Q先举个例子Q?/p>
上面的SQL语句再次插入一条数据: insert Tree values('|络1?,'|络工程') q行l果如下图: ? q行l果 注意点:貌似在递归成员处所选择的字D都必须Tree表的数据Q而不能是CTEl果集中的除了Tree中没有而CTE中有的字D在q里才可以引用,比如字段TE?/p>
首先看下Q遍历的W?条记录的SQL语句Q?/p>
获取的结果ؓQ?/p>
Name Parent TE Levle ------------------------------------- 大学 NULL 大学 0 递归W?ơ所获取的结果集合的cSQL语句为: 上面的CTE子查询的l果是W一ơ递归查询的结果集Q上面SQLq行l果为: 同样的,第二次递归查询的上面三条记录作为第三次查询?#8216;定位成员’Q?/p>
【这里要注意Q上面的三条记录是从最后一条开始依ơ作为第三次递归的输入的Q即W一条是ID=9的记录,接下来是7?Q关于第四次递归也类伹{?/p>
W三ơ递归cSQL语句 l果如下Q?/p>
其实每次递归的类SQL可ؓ如下所C: W四ơ递归一ơ类推,最后所查询的结果ؓ上面所有递归的union?/p>
l:在上面的SQ语句查询l果中,ID?0的记录应该要攑֜ID?的后面?/p>
往数据表中再次d两条记录Q?/p>
insert Tree values('计科','计算机学?) 再次修改上面的SQL语句Q?/p>
最后的l果为: ? q行l果 q样Q无论用h入多条记录都可以进行按部门Q按规律q行查询?/p> BLL?nbsp; public void Update(DataTable dt) dal.Update(dt); DAL?/p>
public void Update(DataTable dt) adapter.InsertCommand = new SqlCommand("INSERT INTO dbo.t6( com_id ,usr_id ) VALUES( @com_id ,@usr_id)", conn); adapter.UpdateCommand = new SqlCommand("update t6 setwhereand usr_id", conn); adapter.DeleteCommand = new SqlCommand("delete from t6 whereand usr_id", conn); adapter.DeleteCommand.Parameters["@com_id"].SourceVersion = DataRowVersion.Original; adapter.Update(dt); 前台 public partial class DataTableUpdate : Form public BLL.Users Bu = new BLL.Users(); public string _UserId = ""; public DataTableUpdate() //H口加蝲 private void Form1_Load(object sender, EventArgs e) private void BindValue() //手动修改可以; 代码赋值需要用下面q句?br /> tb_UsrId.DataBindings[0].DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged; private void 保存_Click(object sender, EventArgs e) private void 删除_Click(object sender, EventArgs e) if (dataGridView1.CurrentCell == null) try private void 增加_Click(object sender, EventArgs e) private void 取消_Click(object sender, EventArgs e) 本节内容 数据添臌?/font>:说明如何创徏新行q将其添臌中?/p>
以下CZ演示了如何通过调用 NewRow Ҏ来创建新行?/p>
DataRow workRow = workTable.NewRow(); 然后您可以用烦引或列名来操作新d的行Q如下例所C?/p>
workRow["CustLName"] = "Smith"; 在将数据插入新行后,Add Ҏ可用于将行添?span class="Apple-converted-space"> DataRowCollectionQ如以下代码所C?/p>
workTable.Rows.Add(workRow); 您也可以通过传入值的数组Q类型化?span class="Apple-converted-space"> ObjectQ,调用 Add Ҏ来添加新行,如下例所C?/p>
workTable.Rows.Add(new Object[] {1, "Smith"}); 类型化?span class="Apple-converted-space"> Object 的值的数组传递到 Add ҎQ可在表内创建新行ƈ其列D|ؓ对象数组中的倹{请注意Q数l中的gҎ它们在表中出现的序相与各列匹配?/p>
以下CZ十行添x建的 Customers 表中?/p>
DataRow workRow; 查看表中数据:说明如何讉K行中的数据,包括数据的原始版本和当前版本?/p>
DataTable 对象?span class="Apple-converted-space"> Select Ҏq回一l与指定条g匚w?span class="Apple-converted-space"> DataRow 对象?strong>Select 采用{选表辑ּ、排序表辑ּ?span class="Apple-converted-space"> DataViewRowState 的可选参数。筛选表辑ּҎ DataColumn |例如 Select ҎZ DataViewRowState 定要查看或操作的行的版本。下表说明了可能?span class="Apple-converted-space"> DataViewRowState 枚D倹{?/p>
在下面的CZ中,DataSet 对象已经q筛选,q样Q您可以只用其 DataViewRowState 讄?span class="Apple-converted-space"> CurrentRows的行?/p>
DataRow[] currRows = workTable.Select(null, null, DataViewRowState.CurrentRows); Select Ҏ可用于返回具有不?span class="Apple-converted-space"> RowState 值或字段值的行。以下示例返回一个引用所有已删除行的 DataRow数组Qƈq回另一个引用所有已排序行(按照 CustLName 排序Q其?span class="Apple-converted-space"> CustID 列大?5Q的 DataRow 数组?/p>
// Retrieve all deleted rows. ~辑表中的数?/font>:说明如何修改行中的数据,包括挂v对行的更改,直至验证q接受了的更攏V?/p>
当您直接?span class="Apple-converted-space"> DataRow 中修改列值时Q?strong>DataRow 会?span class="Apple-converted-space"> Current?strong>Default ?span class="Apple-converted-space"> Original 行版本来理列倹{除q些行版本以外,BeginEdit?strong>EndEdit ?span class="Apple-converted-space"> CancelEdit Ҏq用第四个行版本:Proposed?/p>
在执行编辑操作(通过调用 BeginEdit 开始,q且通过使用 EndEdit ?span class="Apple-converted-space"> CancelEdit 或者通过调用AcceptChanges ?span class="Apple-converted-space"> RejectChanges l束Q的q程中,Proposed 行版本会存在?/p>
在编辑操作过E中Q您可以通过计算 DataTable ?span class="Apple-converted-space"> ColumnChanged 事g中的 ProposedValue 来将验证逻辑应用于各列?strong>ColumnChanged 事g保存 DataColumnChangeEventArgsQ可保持Ҏ在更改的列和ProposedValue 的引用。计了值后Q可以对其进行修Ҏ取消~辑。编辑结束时Q行?span class="Apple-converted-space"> Proposed 状态中Ud?/p>
您可以通过调用 EndEdit 来确认编辑,也可以通过调用 CancelEdit 来取消编辑。请注意Q尽?span class="Apple-converted-space"> EndEdit 实已确认您所做的~辑Q但在调?span class="Apple-converted-space"> AcceptChanges 之前Q?strong>DataSet q没有实际接受更攏V另外请注意Q如果在EndEdit ?span class="Apple-converted-space"> CancelEdit ~辑l束之前调用 AcceptChangesQ编辑将会终止,q接?span class="Apple-converted-space"> Current ?span class="Apple-converted-space"> Original 行版本的 Proposed 行倹{调?span class="Apple-converted-space"> RejectChanges 会以同样的方式结束编辑,q放?span class="Apple-converted-space"> Current ?span class="Apple-converted-space"> Proposed 行版本。在调用 AcceptChanges ?span class="Apple-converted-space"> RejectChanges 之后调用 EndEdit ?span class="Apple-converted-space"> CancelEdit 不会起作用,因ؓ~辑已经l束?/p>
以下CZ演示了如何将 BeginEdit ?span class="Apple-converted-space"> EndEdit ?span class="Apple-converted-space"> CancelEdit 一起用。本CZ也会?span class="Apple-converted-space"> ColumnChanged 事g中的 ProposedValueQƈ军_是否取消~辑?/p>
DataTable workTable = new DataTable(); 行状态与行版?/font>:提供有关行的不同状态的信息?/p>
每个 DataRow 对象都具?span class="Apple-converted-space"> RowState 属性,您可以检查此属性来定行的当前状态。下表给Z对各RowState 枚D值的要说明?/p>
对于已经使用 Remove ҎQ或是在使用 Delete Ҏ之后使用?span class="Apple-converted-space"> AcceptChanges ҎQ从DataRowCollection 中移除的行,也设|ؓ Detached?/p> ?span class="Apple-converted-space"> DataSet?strong>DataTable ?span class="Apple-converted-space"> DataRow 上调?span class="Apple-converted-space"> AcceptChanges Ӟ会移除行状态ؓ Deleted 的所有行。剩余的行会被赋?span class="Apple-converted-space"> Unchanged 行状态,q且 Original 行版本中的g改写?span class="Apple-converted-space"> Current 行版本倹{调?strong>RejectChanges Ӟ会移除行状态ؓ Added 的所有行。剩余的行会被赋?span class="Apple-converted-space"> Unchanged 的行状态,q且Current 行版本中的g改写?span class="Apple-converted-space"> Original 行版本倹{?/p>
通过用列引用来传?span class="Apple-converted-space"> DataRowVersion 参数Q您可以查看行的不同行版本,如下例所C?/p>
DataRow custRow = custTable.Rows[0]; 下表l出了各 DataRowVersion 枚D值的要说明?/p>
通过调用 HasVersion Ҏq将 DataRowVersion 作ؓ参数传递,您可以测?span class="Apple-converted-space"> DataRow 是否h特定的行版本。例如,在调?span class="Apple-converted-space"> AcceptChanges 之前Q?code class="ce">DataRow.HasVersion(DataRowVersion.Original) Ҏd的行返?span class="Apple-converted-space"> false?/p>
例如Q以下代码示例显CZ表中所有已删除行的倹{已删除的行没有 Current 行版本,因此在访问列值时必须传?span class="Apple-converted-space"> DataRowVersion.Original?/p>
DataTable catTable = catDS.Tables["Categories"]; 从表中删除行:说明如何从表中移除行?/p>
在将 DataSet ?span class="Apple-converted-space"> DataTable ?span class="Apple-converted-space"> DataAdapter 和关pd数据源一起用时Q用 DataRow ?span class="Apple-converted-space"> Delete ҎU除行?strong>Delete Ҏ只是?span class="Apple-converted-space"> DataSet ?span class="Apple-converted-space"> DataTable 中将行标Cؓ DeletedQ而不会移除它。?span class="Apple-converted-space"> DataAdapter 在遇到标Cؓ Deleted 的行Ӟ会执行其 DeleteCommand 以在数据源中删除该行。然后,可以用AcceptChanges Ҏ怹U除该行。如果?span class="Apple-converted-space"> Remove 删除该行Q则该行从表中完全U除Q但DataAdapter 不会在数据源中删除该行?/p>
DataRowCollection ?span class="Apple-converted-space"> Remove Ҏ采用 DataRow 作ؓ参数Qƈ其从集合中U除Q如下例所C?/p>
workTable.Rows.Remove(workRow); 作ؓҎQ以下示例演CZ如何调用 DataRow 上的 Delete Ҏ来将?span class="Apple-converted-space"> RowState 改ؓ Deleted?/p>
workRow.Delete(); 如果行标记为删除,q且调用 DataTable 对象?span class="Apple-converted-space"> AcceptChanges ҎQ该行就会从 DataTable 中移除。相比之下,如果调用 RejectChangesQ行?span class="Apple-converted-space"> RowState ׃恢复到被标记?span class="Apple-converted-space"> Deleted 之前的状态?/p>
d和读取行错误信息:说明如何按行插入错误信息Q以用于解决有关应用E序内行中数据的问题?/p>
DataTable workTable = new DataTable("Customers"); 接受或拒l对行的更改:说明如何接受或拒l对行的更改?/p>
如果 DataTable 上存在外键约束,使用 AcceptChanges ?span class="Apple-converted-space"> RejectChanges 接受或拒l的更改׃ҎForeignKeyConstraint.AcceptRejectRule 传播?span class="Apple-converted-space"> DataRow 的子行?/p>
以下CZ查有错误的行Q在适用之处解决错误Q拒l无法解决错误的行。请注意Q对于解决的错误Q?strong>RowErrorg重置为空字符ԌD?span class="Apple-converted-space"> HasErrors 属性设|ؓ false。当解决或拒l了所有的有错误的行时Q就会调?strong>AcceptChanges 来接受对整个 DataTable 的所有更攏V?/p>
if (workTable.HasErrors) 处理 DataTable 事g:提供可用?span class="Apple-converted-space"> DataTable 的事件的相关信息Q包括修改列值和d或删除行时的事g?/p>
以下CZ创徏 4 个事ӞOnColumnChanged?strong>OnColumnChanging?strong>OnRowChanged ?strong>OnRowChanging。这些事件中的每一个都在列或行更改时发生?/p>
workTable.ColumnChanged += new DataColumnChangeEventHandler(OnColumnChanged); @SQL=SELECT COALESCE(MAX(ColumnName),0)+10 AS DefaultValue FROM TableName WHERE xxParentColumn=@xxParentColumn@ The WHERE part of this clause needs to be replaced with the required values. The code that should appear here is the name of the column which links with the id of the parent one. For example, each record of the C_InvoiceLine belongs to a particular C_Invoice record and they are all sequenced. C_Invoice is the parent table for the lines saved in C_InvoiceLine. This table has a column named line and the default value that it takes is: @SQL=SELECT COALESCE(MAX(LINE),0)+10 AS DefaultValue FROM C_INVOICELINE WHERE C_INVOICE_ID=@C_INVOICE_ID@ The first option can be chosen if the original module author wants to
add more columns to his/her module. The second option is possible for
anyone as the columns are added by a new module to the existing one
which is not changed directly.
The main difference between these two methods is the names which
need to be chosen for the columns to comply with the modularity naming
rules.
In the Application Dictionary || Message window create a new record using the following details:
]]>
]]>
$bin/hadoop-daemon.sh start datanode
重新balancer(可?
$bin/hbase-daemon.sh start master
]]>
public class FirstSparkSql {
public static void main(String[] args) {
String masterMode = "local";//spark://master:7077
SparkConf conf = new SparkConf();
//conf.set("spark.executor.memory", "1024m");
conf.setAppName("First Spark SQL");
conf.setMaster(masterMode);
//解决异常Q?/span>IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI
conf.set("spark.sql.warehouse.dir","D:\\temp_files");
JavaSparkContext sc = new JavaSparkContext(conf);
SparkSession spark = SparkSession.builder().config(conf).getOrCreate();
Dataset<Row> df = spark.read().json("hdfs://master:9000/user/spark/input/persons.txt");
df.show();
sc.stop();
}
}
]]>
create table tab (
x integer,
y date,
z varchar2(30)
);
alter table tab modify (y timestamp);
ORA-54033: column to be modified is used in a virtual column expression
select column_name, data_default, hidden_column
from user_tab_cols
where table_name = 'TAB';
COLUMN_NAME DATA_DEFAULT HID
------------------------------ ----------------------------- ---
SYS_STUYPW88OE302TFVBNC6$MMQXE SYS_OP_COMBINED_HASH("X","Y") YES
Z NO
Y NO
X NO
exec dbms_stats.drop_extended_stats(user, 'tab', '(x, y)');
alter table tab modify (y timestamp);
select dbms_stats.create_extended_stats(user, 'tab', '(x, y)')
from dual;
DBMS_STATS.CREATE_EXTENDED_STATS(USER,'TAB','(X,Y)')
--------------------------------------------------------------------------------
SYS_STUYPW88OE302TFVBNC6$MMQXE
These actions will help prevent future developers getting stuck tracking down the cause of "missing" virtual columns!
]]><input class="easyui-combobox" id="rwlb" name="rwlb" style="width:435px" data-options="valueField:'id', textField:'text', panelHeight:'auto'" >
1 var data, json;
2 json = '[{"id":"q计?,"text":"q计?,"selected":true}]';
3 data = $.parseJSON(json);
4 $("#rwlb").combobox("loadData", data);
1 var data,json;
2 data = [];
3 data.push({ "text": "试", "id": 100 });
4 $("#rwlb").combobox("loadData", data);
]]>
1
$.extend($.fn.tree.methods, {
2
getLevel:
function
(jq,target){
3
var
l = $(target).parentsUntil(
"ul.tree"
,
"ul"
);
4
return
l.length+1;
5
}
6
});
1
var
node = $().tree(
"getSelected"
);
2
var
lv = $().tree(
"getLevel"
,node.target);
]]>
select to_char(100,'XX') from dual;
其中XX为格式,注意XX的位C能小?/span>传入的参数?br />
]]>
void foo(int a, int b = 1, bool c = false);
?a style="color: rgb(51,51,51); font-size: 14px; text-decoration: none" class="keylink" target="_blank">Java中,则可以通过函数重蝲来设|函数参数默认|
public void foo(int a){
foo(a, 1);
}
public void foo(int a, int b){
foo(a, b, false);
}
public void foo(int a, int b, bool c){
//函数内容
}
而在JavaScript中,如何像jQuery那样讄函数参数默认值呢QJavaScript中ƈ没有像C语言中定义函数时直接在参数后面赋值的ҎQ也没有像Java里那L函数重蝲Q但我们可以通过JavaScriptҎ中的一个arguments只读变量数组来实玎ͼ具体如下Q?/p>
function foo(){
var a = arguments[0] ? arguments[0] : 1;
var b = arguments[1] ? arguments[1] : false;
//函数内容
}
以上是通过判断参数是否存在Q若不存在则默认值附l变量,而我们可以通过判断参数的类型来实现重蝲Q?/p>
function foo(){
if(typeof arguments[0] == 'string')
alert('参数cd为字W串');
else if(typeof arguments[0] == 'number')
alert('参数cd为数?);
}
或者:
function foo(){
if(arguments[0].constructor == String)
alert('参数cd为字W串');
else if(arguments[0].constructor == Number)
alert('参数cd为数?);
}
]]>
insert Tree values('?,'|络1?)
{
foreach (DataRow dr in dt.Rows)
{
if (dr.RowState == DataRowState.Deleted)
continue;
if (dr.RowState == DataRowState.Modified || dr.RowState == DataRowState.Added)
{
if (dr["usr_id"] == DBNull.Value)
{
throw new Exception("用户代码不能为空");
} }
}
}
{
SqlDataAdapter adapter = new SqlDataAdapter();
SqlConnection conn = new SqlConnection(SqlHelper.ConnectionString);
conn.Open();
adapter.InsertCommand.CommandType = CommandType.Text;
adapter.InsertCommand.Parameters.Add("@com_id", SqlDbType.VarChar, 4, "com_id");
adapter.InsertCommand.Parameters.Add("@usr_id", SqlDbType.VarChar, 8, "usr_id");
adapter.UpdateCommand.CommandType = CommandType.Text;
adapter.UpdateCommand.Parameters.Add("@com_id", SqlDbType.VarChar, 4, "com_id");
adapter.UpdateCommand.Parameters.Add("@usr_id", SqlDbType.VarChar, 8, "usr_id");
adapter.UpdateCommand.Parameters.Add("@usr_id1", SqlDbType.VarChar, 8, "usr_id");
adapter.UpdateCommand.Parameters["@usr_id1"].SourceVersion = DataRowVersion.Original;
adapter.DeleteCommand.CommandType = CommandType.Text;
adapter.DeleteCommand.Parameters.Add("@com_id", SqlDbType.VarChar, 4, "com_id");
adapter.DeleteCommand.Parameters.Add("@usr_id", SqlDbType.VarChar, 8, "usr_id");
adapter.DeleteCommand.Parameters["@usr_id"].SourceVersion = DataRowVersion.Original;
}
{
public DataTable dtUsr = new DataTable();
public MOD.Users modObject = new MOD.Users();
{
InitializeComponent();
dataGridView1.AutoGenerateColumns = false;
}
{
dtUsr = Bu.GetList();
dataGridView1.DataSource = dtUsr;
BindValue();
}
{
tb_com_id.DataBindings.Add("Text", dataGridView1.DataSource, "com_id");
tb_UsrId.DataBindings.Add("Text", dataGridView1.DataSource, "usr_id");
}
{
foreach (DataRow dr in dtUsr.Rows)
{
dr.EndEdit();
}
try
{
Bu.Update(dtUsr);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
MessageBox.Show("保存成功Q?, "pȝ提示");
}
{
if (MessageBox.Show("您确认要删除用户Q? + tb_UsrName.Text.Trim()+" ?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
return;
return;
{
dataGridView1.Rows.Remove(dataGridView1.CurrentRow);
Bu.Update(dtUsr);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
MessageBox.Show("删除成功Q?, "pȝ提示");
}
{
DataRow dr = dtUsr.NewRow();
dr["usr_id"] = _UserId;
dtUsr.Rows.Add(dr);
dataGridView1.CurrentCell = dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0];
}
{
dtUsr.RejectChanges();
}
牛铁Q?a style="color: rgb(63,167,203); text-decoration: underline" >http://blog.csdn.net/fangxinggood/archive/2008/04/18/2304047.aspx
]]>
?span class="Apple-converted-space"> DataSet 中创?span class="Apple-converted-space"> DataTable 之后Q您执行的活动可以与使用数据库中的表时执行的zd相同。您可以d、查看、编辑和删除表中的数据;可以监视错误和事Ӟq且可以查询表中的数据。在修改 DataTable 中的数据Ӟ您也可以验证更改是否正确Qƈ军_是否以编E方式接受更Ҏ拒绝更改?/p>
在创?span class="Apple-converted-space"> DataTable q用列和约束定义其l构之后Q您可以新的数据行添至表中。要d新行Q可一个新变量声明?span class="Apple-converted-space"> DataRow cd。调?span class="Apple-converted-space"> NewRow ҎӞ返回新?span class="Apple-converted-space"> DataRow 对象。然后,DataTable 会根据表的结构按 DataColumnCollection 的定义创?span class="Apple-converted-space"> DataRow 对象?
workRow[1] = "Smith";
for (int i = 0; i <= 9; i++)
{
workRow = workTable.NewRow();
workRow[0] = i;
workRow[1] = "CustName" + i.ToString();
workTable.Rows.Add(workRow);
}
可以使用 DataTable ?span class="Apple-converted-space"> Rows ?span class="Apple-converted-space"> Columns 集合来访?span class="Apple-converted-space"> DataTable 中的内容。也可以Ҏ包括搜烦标准、排序顺序和行状态等特定标准Q?span class="Apple-converted-space"> DataTable.Select Ҏq回 DataTable 中数据的子集。此外,用主键值搜索特定行Ӟq可使用 DataRowCollection ?span class="Apple-converted-space"> LastName = 'Smith'
。排序表辑ּ遵@用于为列排序的标?SQL U定Q例?span class="Apple-converted-space"> LastName ASC, FirstName ASC
。有关编写表辑ּ的规则,请参?strong>DataColumn cȝ 提示 如果您将?span class="Apple-converted-space"> DataTable ?span class="Apple-converted-space"> Select Ҏ执行多次调用Q可通过先ؓ DataTable 创徏 DataView来提高性能。创?span class="Apple-converted-space"> DataView 会ؓ表中的行~制索引。然后,Select Ҏ会用该索引Q这样将显著~短生成查询l果的时间。有关ؓ DataTable 创徏 DataView 的信息,请参?a style="color: rgb(51,102,153); text-decoration: none" >创徏和?DataView?/blockquote>
成员名称
说明
CurrentRows
当前行,包括未更改的行、已d的行和已修改的行?/td>
Deleted
已删除的行?/td>
ModifiedCurrent
当前版本Q它是原始数据的修改版本Q请参阅ModifiedOriginalQ?/td>
ModifiedOriginal
所有已修改行的原始版本。?span class="Apple-converted-space"> ModifiedCurrent Ӟ当前版本可用?/td>
Added
新行?/td>
None
无?/td>
OriginalRows
原始行,包括未更改的行和已删除的行?/td>
Unchanged
未更改的行?/td>
if (currRows.Length < 1 )
Console.WriteLine("No Current Rows Found");
else
{
foreach (DataColumn myCol in workTable.Columns)
Console.Write("/t{0}", myCol.ColumnName);
Console.WriteLine("/tRowState");
foreach (DataRow myRow in currRows)
{
foreach (DataColumn myCol in workTable.Columns)
Console.Write("/t{0}", myRow[myCol]);
Console.WriteLine("/t" + myRow.RowState);
}
}
DataRow[] delRows = workTable.Select(null, null, DataViewRowState.Deleted);
// Retrieve rows where CustID > 5, and order by CustLName.
DataRow[] custRows = workTable.Select("CustID > 5", "CustLName ASC");
当您?span class="Apple-converted-space"> DataRow 中更改列值时Q所做更改会立即|于行的 Current 状态中。然后,RowState 会设|ؓModifiedQƈ使用 DataRow ?span class="Apple-converted-space"> AcceptChanges ?span class="Apple-converted-space"> RejectChanges Ҏ来接受或拒绝所做更攏V?strong>DataRowq提供了三种可用于在~辑行时行的状态挂LҎ。这些方法是 BeginEdit?strong>EndEdit ?span class="Apple-converted-space"> CancelEdit?
workTable.Columns.Add("LastName", typeof(String));
workTable.ColumnChanged += new DataColumnChangeEventHandler(OnColumnChanged);
DataRow workRow = workTable.NewRow();
workRow[0] = "Smith";
workTable.Rows.Add(workRow);
workRow.BeginEdit();
// Causes the ColumnChanged event to write a message and cancel the edit.
workRow[0] = "";
workRow.EndEdit();
// Displays "Smith, New".
Console.WriteLine("{0}, {1}", workRow[0], workRow.RowState);
protected static void OnColumnChanged(Object sender, DataColumnChangeEventArgs args)
{
if (args.Column.ColumnName == "LastName")
if (args.ProposedValue.ToString() == "")
{
Console.WriteLine("Last Name cannot be blank. Edit canceled.");
args.Row.CancelEdit();
}
}
ADO.NET 用行状态和版本理表中的行。行状态表C的状态。当修改行时Q行版本会维护存储于行中的|包括当前倹{原始值和默认倹{例如,修改了某行中的一列后Q该行会有一?span class="Apple-converted-space"> Modified 的行状态,q且会存在两个行版本Q?strong>CurrentQ包含当前行|?span class="Apple-converted-space"> OriginalQ包含修改该列前的行|?
RowState
说明
Unchanged
自上ơ调?span class="Apple-converted-space"> AcceptChanges 之后Q或?span class="Apple-converted-space"> DataAdapter.Fill 创徏了行之后Q未做出qQ何更攏V?/td>
Added
已将行添臌中,但尚未调?span class="Apple-converted-space"> AcceptChanges?/td>
Modified
已更改了行的一些元素?/td>
Deleted
已将该行从表中删除,q且未调用 AcceptChanges?/td>
Detached
对于已经创徏但不属于M DataRowCollection 的行Q设|ؓ Detached。新?span class="Apple-converted-space"> RowState讄?span class="Apple-converted-space"> Detached。通过调用 Add Ҏ新?span class="Apple-converted-space"> DataRow 添至 DataRowCollection 之后Q?strong>RowState 属性的D|ؓ Added?
string custID = custRow["CustomerID", DataRowVersion.Original].ToString();
DataRowVersion
说明
Current
行的当前倹{如果是?span class="Apple-converted-space"> Deleted ?span class="Apple-converted-space"> RowState 的行Q则不存在此行版本?/td>
Default
特定行的默认行版本?strong>Added?strong>Modified ?span class="Apple-converted-space"> Unchanged 行的默认行版本是Current?strong>Deleted 行的默认行版本是 Original?strong>Detached 行的默认行版本是 Proposed?/td>
Original
行的原始倹{如果是?span class="Apple-converted-space"> Added ?span class="Apple-converted-space"> RowState 的行Q则不存在此行版本?/td>
Proposed
行的倹{在对行q行~辑操作期间Q或对于不属?span class="Apple-converted-space"> DataRowCollection 的行Q存在此行版本?/td>
DataRow[] delRows = catTable.Select(null, null, DataViewRowState.Deleted);
Console.WriteLine("Deleted rows:/n");
foreach (DataColumn catCol in catTable.Columns)
Console.Write(catCol.ColumnName + "/t");
Console.WriteLine();
foreach (DataRow delRow in delRows)
{
foreach (DataColumn catCol in catTable.Columns)
Console.Write(delRow[catCol, DataRowVersion.Original] + "/t");
Console.WriteLine();
}
用于?span class="Apple-converted-space"> DataTable 对象中删?span class="Apple-converted-space"> DataRow 对象的方法有两种Q?strong>DataRowCollection 对象?span class="Apple-converted-space"> Remove Ҏ?strong>DataRow 对象?span class="Apple-converted-space"> Delete Ҏ?strong>Remove Ҏ?span class="Apple-converted-space"> DataRowCollection 中删?span class="Apple-converted-space"> DataRowQ?span class="Apple-converted-space"> Delete Ҏ只将行标Cؓ删除。当应用E序调用 AcceptChanges ҎӞ才会发生实际的删除。通过使用 DeleteQ您可以在实际删除之前先以编E方式检查哪些行标记为删除。如果将行标Cؓ删除Q其 RowState 属性会讄?span class="Apple-converted-space"> Deleted?
注意 如果 DataRow ?span class="Apple-converted-space"> RowState ?span class="Apple-converted-space"> AddedQ则意味着已将其添臌中,然后其标记?strong>DeletedQ从表中U除?/blockquote>
Z避免在编?span class="Apple-converted-space"> DataTable 中的值时每次发生行错误都必须响应Q可错误信息添臌中,以便以后使用?strong>DataRow 对象通过对各行提?span class="Apple-converted-space"> RowError 属性来支持此功能。将数据添至 DataRow ?span class="Apple-converted-space"> RowError 属性会?strong>DataRow ?span class="Apple-converted-space"> HasErrors 属性标Cؓ true。如?span class="Apple-converted-space"> DataRow ?span class="Apple-converted-space"> DataTable 的组成部分,?span class="Apple-converted-space"> DataRow.HasErrors?span class="Apple-converted-space"> trueQ则 DataTable.HasErrors 属性也?span class="Apple-converted-space"> true。这也适用?span class="Apple-converted-space"> DataTable 所属的 DataSet。ؓ错误做测试时Q可以检?span class="Apple-converted-space"> HasErrors 属性以定错误信息是否已添x有行。如?span class="Apple-converted-space"> HasErrors ?span class="Apple-converted-space"> trueQ则可?span class="Apple-converted-space"> DataTable ?strong>GetErrors Ҏ以便只返回和查有错误的行Q如下例所C?
workTable.Columns.Add("CustID", typeof(Int32));
workTable.Columns.Add("Total", typeof(Double));
workTable.RowChanged += new DataRowChangeEventHandler(OnRowChanged);
for (int i = 0; i < 10; i++)
workTable.Rows.Add(new Object[] {i, i*100});
if (workTable.HasErrors)
{
Console.WriteLine("Errors In Table " + workTable.TableName);
foreach (DataRow myRow in workTable.GetErrors())
{
Console.WriteLine("CustID = " + myRow["CustID"]);
Console.WriteLine(" Error = " + myRow.RowError + "/n");
}
}
protected static void OnRowChanged(Object sender, DataRowChangeEventArgs args)
{
// Check for zero values.
if (args.Row["Total"].Equals(0D))
args.Row.RowError = "Total cannot be 0.";
}
在检验过?span class="Apple-converted-space"> DataTable 中的数据所做更改的准确性之后,可?span class="Apple-converted-space"> DataRow?strong>DataTable ?span class="Apple-converted-space"> DataSet ?strong>AcceptChanges Ҏ来接受更改,此方法会?span class="Apple-converted-space"> Current 行D|ؓ Original |q会?span class="Apple-converted-space"> RowState 属性设|ؓ Unchanged。接受或拒绝更改会清除所?span class="Apple-converted-space"> RowError 信息Qƈ?span class="Apple-converted-space"> HasErrors 属性设|ؓ false。接受或拒绝更改q可以媄响在数据源中更新数据。有x多信息,请参?a style="color: rgb(51,102,153); text-decoration: none" >使用 DataAdapter ?DataSet 更新数据?/a>?
{
foreach (DataRow errRow in workTable.GetErrors())
{
if (errRow.RowError == "Total cannot exceed 1000.")
{
errRow["Total"] = 1000;
errRow.RowError = ""; // Clear the error.
}
else
errRow.RejectChanges();
}
}
workTable.AcceptChanges();
DataTable 对象提供一pd可由应用E序处理的事件。下表说明了 DataTable 事g?
事g
说明
ColumnChanged
在值已成功插入列时发生?/td>
ColumnChanging
在已提交列值时发生?/td>
RowChanged
在已成功~辑表中的行后发生?/td>
RowChanging
当正在更改表中的行时发生?/td>
RowDeleted
在表中的某行已被标记?span class="Apple-converted-space"> Deleted 之后发生?/td>
RowDeleting
在表中的某行被标Cؓ Deleted 之前发生?/td>
workTable.ColumnChanging += new DataColumnChangeEventHandler(OnColumnChanging);
workTable.RowChanged += new DataRowChangeEventHandler(OnRowChanged);
workTable.RowChanging += new DataRowChangeEventHandler(OnRowChanging);
protected static void OnColumnChanged(object sender, DataColumnChangeEventArgs args)
{
Console.Write(" ColumnChanged: ");
Console.Write(args.Column.ColumnName + " changed to '" + args.ProposedValue + "'/n");
}
protected static void OnColumnChanging(object sender, DataColumnChangeEventArgs args)
{
Console.Write("ColumnChanging: ");
Console.Write(args.Column.ColumnName + " equals '" + args.Row[args.Column] +
"', changing to '" + args.ProposedValue + "'/n");
}
protected static void OnRowChanging(object sender, DataRowChangeEventArgs args)
{
if (args.Action != DataRowAction.Nothing)
Console.WriteLine(" RowChanging: Action = " + args.Action + ", CustID = " + args.Row["CustID"]);
}
protected static void OnRowChanged(object sender, DataRowChangeEventArgs args)
{
if (args.Action != DataRowAction.Nothing)
Console.WriteLine(" RowChanged: Action = " + args.Action + ", CustID = " + args.Row["CustID"]);
}
]]>
]]>
]]>
]]>
The new table must include the AD_Client_ID, AD_Org_ID, IsActive, Created, CreatedBy, Updated and UpdatedBy fields that are mandatory and required for security and auditory purposes of the application.
Each table must have at least one column marked as an identifier. The actual values of identifier columns later get concatenated to be shown to the user as a representation of a particular record (see the link to the Sales Order within the Sales Invoice window). These identifiers will also be used to construct dropdown lists of records of that particular table. By default all columns with column name Name are set as an identifier. In case there is no column with this Name, no identifier is set and needs to be done so manually or compilation will fail.
NOTE: The columns that are named line or seqNo are used to contain the sequence number of a record (i.e. the number of a line in an invoice). They take a default value like: How to add Columns to a Table
These changes can be done in two different locations:
How to add a Constraint
Creating a new instance of a Business Object
A business object may never be created using the Java new operator. All business objects should be created using the OBProvider factory class:
// create the object through the factory final Category bpg = OBProvider.getInstance().get(Category.class);
Hibernate will detect that a business object is new when:
So if you want to create a new business object with a specific id (by calling setId(...)) then you explicitly need to call businessObject.setNewOBObject(true). Otherwise, Hibernate will throw an exception ('count of batch update operation....').
一是linux服务器端的tftp-server支持,
二是嵌入式目标系l的tftp-client支持.
因ؓu-boot本n内置支持tftp-client,所以嵌入式目标pȝ端就不用配置?
下面pl介l一下linux服务器端tftp server配置.在redhat 9.0的第三张光盘?有tftp-server的安装rpm?Q?Q?nbsp; 安装
#mount –t iso9660 /dev/hdc /mnt/cdrom //挂蝲光盘
#rpm -ivh tftp-server-0.32-4.i386.rpm //安装
#umount /mnt/cdrom //卸蝲光盘
Q?Q修Ҏ件在linux?不管使用的是哪一Usuper-server,inetd或者xinetd,默认情况下TFTP服务是禁用的,所以要修改文g来开启服?
ҎQ?Q的安装Ҏ,可以修改文g/etc/xinetd.d/tftp.主要是设|TFTP服务器的根目?开启服?
修改后的文g如下:
service tftp {
socket_type =dgram
protocol =udp
wait =yes
user =root
server =/usr/sbin/in.tftpd
server_args =-s /home/app -c
disable =no
per_source =11
cps =100 2
flags =IPv4
}
说明:修改server_args= -s <path> -c,其中<path>处可以改Z的tftp server配置的根目录,参数-s指定chroot,-c指定了可以创建文?
Q?Q创建tftp根目?关闭防火?启动tftp-server.
#mkdir /home/app
#chmod o+w /home/app
#/etc/init.d/iptables stop //关闭防火?/p>
#service xinetd restart //重启 xinetd 服务
重启xinetd服务,因ؓTFTP服务受控与xinetd, xinetd是管服务的服?它是不开端口?
验证一下TFTP是否h?
# netstat -nlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:32768 0.0.0.0:* LISTEN 3122/rpc.statd
tcp 0 0 127.0.0.1:32781 0.0.0.0:* LISTEN 4035/xinetd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3103/portmap
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3324/httpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 3255/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 3213/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3295/sendmail: acce
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 3415/0
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 3324/httpd
udp 0 0 0.0.0.0:32768 0.0.0.0:* 3122/rpc.statd
udp 0 0 0.0.0.0:69 0.0.0.0:* 4035/xinetd ;
可以看到69端口已经打开
udp 0 0 0.0.0.0:69 0.0.0.0:* 4012/in.tftpd
udp 0 0 0.0.0.0:111 0.0.0.0:* 3103/portmap
udp 0 0 0.0.0.0:754 0.0.0.0:* 3122/rpc.statd
udp 0 0 0.0.0.0:631 0.0.0.0:* 3213/cupsd
q样,tftp server配置的启动步骤就完成了?/p>
你可以登陆本机测试以?命o如下:
#tftp your-ip-address
tftp>get <download file>
tftp>put <upload file>
tftp>q
原因 Q工E只支持UNICODE字符
解决ҎQ?/p>
工程属?>配置属?#8211;>常规—>字符?#8212;->使用多字节符字符?/strong>
?、几点要CQ?/p>
1 使用#using引用C# DLLQ而不?include.我就是想当然的用了后者,所以浪费了一上午的时_
2 别忘了using namespace CSLibQ?/p>
3 使用C++/clr语法Q采用正的讉K托管对象Q即Q用帽?#8216;^’Q而不是星?#8216;*’?br />
PSQ附上自己成功运行C++代码
#include "stdafx.h"
#include <iostream>
//#using "..\..\SFCSDLL.dll" //叛_目-->引用...Q添加新引用Q将DLLd到项目中Q可以不用此行代?/p>
using namespace std;
using namespace SFCSDLL;
int _tmain(int argc, _TCHAR* argv[])
{
Class1 ^c = gcnew Class1();
c->SFCSDLL_Create_Connection("127.0.0.1", 0, 0, 0, 0);
c->SFCSDLL_Get_DLLVersion();
c->SFCSDLL_Close_Connection();
cout<<"end...";
system("pause");
return 0;
}
|上最常见的做法是?/span>DataGridView?/span>RowPostPaint事g?/span>RowHeaderCell中绘制行P
privatevoiddataGridView1_RowPostPaint(objectsender, DataGridViewRowPostPaintEventArgs e)
{
try
{
e.Graphics.DrawString((e.RowIndex + 1).ToString(), e.InheritedRowStyle.Font, new SolidBrush(Color.CadetBlue), e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + 5);
}
catch(Exception ex)
{
MessageBox.Show("d行号时发生错误,错误信息Q?/span>"+ex.Message, "操作p|");
}
}
但是q种Ҏ在大数据量的时候性能比较差,每次滚动数据都会触发RowPostPaint事g?/span>
在VS2008里,也可以像Eclipse那样自动生成get 、setҎ?br />
下面是两个具体操作的ҎQ?br />
1、在~写的字D上单击右键----->重构------->装字段
2、在I白行处Q输?#8220;prop”再按Tab?/p>
Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Personal Edition on Windows NT 5.1 (Build 2600: Service Pack 2)