喜的朋友,我要在我的数据库中创建索引,其中包含不同的列如SAL,age.But我得到了一个错误failedoperationexception错误在创建索引。
无法创建指数"Id_Index"的。我的代码是
请帮我
SqlConnection con = new SqlConnection(@"Data Source=MAHESH-F7B2934C\BABA;Initial Catalog=te;Integrated Security=True;Pooling=True");
ServerConnection sc = new ServerConnection(con);
Server srv = new Server(sc);
try{
Database db = srv.Databases["te"];
Table tb = new Table(db, "QRHDQ1");
if (tb != null)
{
Index id = new Index(tb, "Id_index");
id.IndexKeyType = IndexKeyType.DriPrimeryKey;
IndexedColumn indexedcol = new IndexedColumn(id, "id",true);
id.IndexedColumns.Add(indexedcol);
id.IsClustered = true;
id.Create();
}