WIDatabase WIDB;
CDatabaseInfo DBInfo;
DBInfo = new CDatabaseInfo();
DBInfo.DatabaseType = eDatabaseType.SQL;
DBInfo.Location = "SqlServer";
DBInfo.DBName = "TestDatabase";
DBInfo.Username = "LoginName";
DBInfo.Password = "LoginPassword";
WIDB = new WIDatabase(DBInfo);
WIDB.Index.Table("Persons");
WIDB.Index.Column("FirstName");
if (!WIDB.Index.Create("IdxFirst"))
{
MessageBox.Show(string.Format("Failed To Create Index IdxFirst\n{0} - {1}",
WIDB.LastError.ToString(), WIDB.LastErrorMessage));
return(false);
}
WIDB.Index.Clear();
WIDB.Index.Table("Persons");
WIDB.Index.Column("LastName");
WIDB.Index.Unquie();
if (!WIDB.Index.Create("IdxLast"))
{
MessageBox.Show(string.Format("Failed To Create Index IdxLast\n{0} - {1}",
WIDB.LastError.ToString(), WIDB.LastErrorMessage));
return(false);
}
WIDB.Index.Clear();
WIDB.Index.Table("Persons");
WIDB.Index.Column("FirstName");
WIDB.Index.Column("LastName");
if (!WIDB.Index.Create("IdxNames"))
{
MessageBox.Show(string.Format("Failed To Create Index IdxNames\n{0} - {1}",
WIDB.LastError.ToString(), WIDB.LastErrorMessage));
return(false);
}
WIDB.Close();