I've got my code set up like this:
我的代码设置如下:
using (MyDataContext TheDC = new MyDataContext())
{
TheDC.ExecuteCommand("CHECKIDENT('SomeTableName', RESEED, 1)");
TheDC.SubmitChanges();
}
And I'm getting the following error:
我收到以下错误:
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code
System.Data.dll中出现“System.Data.SqlClient.SqlException”类型的异常,但未在用户代码中处理
Additional information: Incorrect syntax near 'SomeTableName'.
附加信息:'SomeTableName'附近的语法不正确。
I looked online and the syntax seems fine, but it's not; what do I need to change?
我在线查看,语法似乎很好,但事实并非如此;我需要改变什么?
Thanks.
1 个解决方案
#1
using (MyDataContext TheDC = new MyDataContext())
{
TheDC.ExecuteCommand("DBCC CHECKIDENT('SomeTableName', RESEED, 1)");
TheDC.SubmitChanges();
}
#1
using (MyDataContext TheDC = new MyDataContext())
{
TheDC.ExecuteCommand("DBCC CHECKIDENT('SomeTableName', RESEED, 1)");
TheDC.SubmitChanges();
}