.net 如何使用Telerik OpenAccess ORM截断表?
我已经试过了.net 如何使用Telerik OpenAccess ORM截断表?,.net,telerik,openaccess,telerik-open-access,.net,Telerik,Openaccess,Telerik Open Access,我已经试过了 ObjectScope.GetSqlQuery("TRUNCATE TABLE %table_name%", null, null).Execute(); 及 第一排什么也不做。第二个抛出异常: line 1:10: unexpected token: ["TABLE",<42>,line=1,col=10] Original Query: TRUNCATE TABLE DayExtent 第1:10行:意外标记:[“表” 原始查询:截断表DayExtent exe
ObjectScope.GetSqlQuery("TRUNCATE TABLE %table_name%", null, null).Execute();
及
第一排什么也不做。第二个抛出异常:
line 1:10: unexpected token: ["TABLE",<42>,line=1,col=10]
Original Query: TRUNCATE TABLE DayExtent
第1:10行:意外标记:[“表”
原始查询:截断表DayExtent
executedLScript方法在DDL和DML脚本之间没有区别。它只要求没有打开的对象作用域
IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();
//do something here
scope.Dispose();
string tableToTruncate = "SOME_TABLE";
scope.Database.GetSchemaHandler().ExecuteDDLScript(string.Format("TRUNCATE TABLE {0}", tableToTruncate));
scope = ObjectScopeProvider1.GetNewObjectScope();
//do something again
希望这能有所帮助。方法executedLScript对DDL和DML脚本没有影响。它只要求没有打开的对象作用域
IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope();
//do something here
scope.Dispose();
string tableToTruncate = "SOME_TABLE";
scope.Database.GetSchemaHandler().ExecuteDDLScript(string.Format("TRUNCATE TABLE {0}", tableToTruncate));
scope = ObjectScopeProvider1.GetNewObjectScope();
//do something again
希望有帮助。您不应该提供表名而不是变量吗?当然,在实际代码中,我提供了表名。我使用了%table\u name%作为占位符。您不应该提供表名而不是变量吗?当然,在实际代码中我提供表名。我已使用%table\u name%作为占位符。