Access to create a table and Index

Source: Internet
Author: User
/**/ /// <Summary>
///Clear previous online table records (this method is called during application initialization)
/// </Summary>
/// <Returns> </returns>
Public   Static   Int Initonlinelist ()
{

Int Result = 1 ;

Try
{
Database. executenonquery (commandtype. Text,"Drop table ["+Baseconfigfactory. gettableprefix+"Online]");
}
Catch
{
Result=-1;
}
Finally
{

Try
{
Database. executenonquery (commandtype. Text, " Create Table [ " + Baseconfigfactory. gettableprefix + " Online] ([olid] counter primary key, [userid] long not null default-1, [IP] varchar (20) not null Default \ " 0.0 . 0.0 \ " , [Username] varchar (20) not null Default \ " \ " , [Tickcount] long not null default 0, [nickname] varchar (20) not null Default \ " \ " , [Password] varchar (80) not null Default \ " \ " , [Groupid] integer not null default 0, [olimg] varchar (80) not null, [adminid] integer not null default 0, [invisible] integer not null default 0, [action] integer not null default 0, [lastactivity] integer not null default 0, [lastposttime] datetime Default \ " 1900 - 1 - 1   00 : 00 : 00 \ " , [Lastpostpmtime] datetime Default \ " 1900 - 1 - 1   00 : 00 : 00 \ " , [Lastsearchtime] datetime Default \ " 1900 - 1 - 1   00 : 00 : 00 \ " , [Lastupdatetime] datetime default now (), [forumid] integer not null default 0, [forumname] varchar (50) not null Default \ " \ " , [Titleid] long not null default 0, [title] varchar (80) not null Default \ " \ " , [Verifycode] varchar (10) Not null Default \ " \ " ) " );
Database. executenonquery (commandtype. Text, " Create index [Forum] on [dnt_online] ([userid], [forumid], [invisible]) " );
Database. executenonquery (commandtype. Text, " Create index [invisible] on [dnt_online] ([userid], [invisible]) " );
Database. executenonquery (commandtype. Text, " Create index [forumid] on [dnt_online] ([forumid]) " );
Database. executenonquery (commandtype. Text, " Create index [Password] on [dnt_online] ([userid], [Password]) " );
Database. executenonquery (commandtype. Text, " Create index [IP] on [dnt_online] ([userid], [IP]) " );
}
Catch
{
Result=-1;
}
}

Return Result;

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.