Intersoft Support Center

Binding Access Database to WebScheduler Using ISDataSource

This walkthrough shows you how to bind Access database to WebScheduler using ISDataSource.

During this walkthrough, you will learn how to do the following:

  • Use ISDataSource.
  • Use SmartTag to set DataSource.
  • Use Data Source Configuration Wizard to set the Database and table.

 Prerequisites

In order to complete this walkthrough, you will need the following:

  • Access to the Microsoft Access Northwind database.
  • Visual Studio 2005/2008/2010 Application.

 Step-By-Step Instructions

To create new web application and bind ISDataSource to WebScheduler

  1. Launch Visual Studio.NET 2008.
  2. Click on File menu, then select New and click Web Site.
  3. Select ASP.NET Web Site in the Template box and set Location to HTTP.
  4. Named the Web Site and click OK.
  5. Right-click on Project's name and select Add New Item.
  6. Select Intersoft AppForm in the My Templates box and named it as Walkthrough.aspx.
  7. Drag and drop WebScheduler and ISDataSource instances from toolbar to WebForm.
  8. Right click on WebScheduler control and choose WebScheduler Database Wizard.
  9. Click Get SQL Script to automatically generate SQL queries. Note that you are required to select the option MS Access Compatible for the query.



  10. Open Microsoft Office Access and create a database named WebScheduler_Movies.mdb.
  11. Create Query Design and switch to SQL View like following:



  12. Copy all queries from SQLScriptDialog box from WebScheduler Database Wizard. Note that copying multiple queries at a time is not possible in Microsoft Access Database. Therefore, you need to copy each query to Microsoft Access and run them respectively.



  13. In the solution Explorer, right click on App_Data and select Add Existing Item. Find and add WebScheduler_Movies.mdb that you just created.
  14. In the Solution Explorer, right-click on App_Code and select Add New Item.
  15. Add a Dataset and named it WebScheduler_Movies.xsd.
  16. Drag and drop the tables from server explorer to the dataset then save the dataset.



  17. In the Solution Explorer, right-click on App_Code and select Add New Item.
  18. Add a new class and named it WebScheduler_Movies.cs.
  19. Here is the WebScheduler_Movies.cs content.

    C# Copy Code
    using System.Data.OleDb;
    namespace WebScheduler_MoviesTableAdapters
    {   
       public partial class EventsTableAdapter : global::System.ComponentModel.Component     
       {         
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]              
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]                     
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]     
          public virtual int Insert(int EventID, string CategoryID, global::System.Nullable<int> ResourceID, global::System.Nullable<int> Mode, string Subject, 
             string Description, string Location, bool AllDayEvent,          
             global::System.Nullable<global::System.DateTime> StartTime,            
             global::System.Nullable<global::System.DateTime> EndTime, global::System.Nullable<int> ReminderTimeSpan)         
          {             
             this.Connection.Open();             
             try             
             {                 
                this.Insert(CategoryID, ResourceID, Mode, Subject, Description, Location, AllDayEvent, StartTime, EndTime, ReminderTimeSpan);                 
                OleDbCommand command = new OleDbCommand();                  
                command.CommandText = "SELECT @@IDENTITY";                  
                command.Connection = this.Connection;                 
                return (int)command.ExecuteScalar();             
             }            
             finally             
             {                  
                this.Connection.Close();             
             }         
          }     
       }       
    
       public partial class RecurringEventsTableAdapter : global::System.ComponentModel.Component     
       {     
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]           
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]           
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]   
          public virtual int Insert(int EventID, global::System.Nullable<int> RecurrenceID, string CategoryID, global::System.Nullable<int> ResourceID,         
             global::System.Nullable<int> ParentID, global::System.Nullable<int> Mode, string Subject, string Description, string Location, bool AllDayEvent,         
             global::System.Nullable<global::System.DateTime> StartTime, global::System.Nullable<global::System.DateTime> EndTime,                  
             global::System.Nullable<global::System.DateTime> ExceptionDate, global::System.Nullable<int> ExceptionInfo, global::System.Nullable<int> ReminderTimeSpan)     
          {      
             this.Connection.Open();      
             try         
             {             
                this.Insert(RecurrenceID, CategoryID, ResourceID, ParentID, Mode, Subject, Description, Location, AllDayEvent, StartTime, EndTime, ExceptionDate, ExceptionInfo, ReminderTimeSpan);             
                OleDbCommand command = new OleDbCommand();              
                command.CommandText = "SELECT @@IDENTITY";              
                command.Connection = this.Connection;             
                return (int)command.ExecuteScalar();         
             }        
             finally         
             {             
                this.Connection.Close();         
             }     
          }
       }
    
       public partial class RecurrenceInfoTableAdapter : global::System.ComponentModel.Component
       {    
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]          
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]          
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]  
          public virtual int Insert(int RecurrenceID, global::System.Nullable<int> Mode, global::System.Nullable<int> RangeMode,         
             global::System.Nullable<global::System.DateTime> StartDate, global::System.Nullable<global::System.DateTime> EndDate,         
             global::System.Nullable<int> TotalRecurrences, global::System.Nullable<int> NDay, global::System.Nullable<int> NWeek,         
             global::System.Nullable<int> NMonth, global::System.Nullable<int> NYear, string WeekDays)   
          {      
             this.Connection.Open();      
             try         
             {           
                this.Insert(Mode, RangeMode, StartDate, EndDate, TotalRecurrences, NDay, NWeek, NMonth, NYear, WeekDays);              
                OleDbCommand command = new OleDbCommand();               
                command.CommandText = "SELECT @@IDENTITY";               
                command.Connection = this.Connection;              
                return (int)command.ExecuteScalar();         
             }     
             finally        
             {            
                this.Connection.Close();        
             }    
          }
       }
    
       public partial class CategoriesTableAdapter : global::System.ComponentModel.Component
       {
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)] 
          public virtual int Insert(int CategoryID, string CategoryName, string Description, string CategoryColor)  
          {    
             this.Connection.Open();      
             try      
             {        
                this.Insert(CategoryName, Description, CategoryColor);         
                OleDbCommand command = new OleDbCommand();          
                command.CommandText = "SELECT @@IDENTITY";          
                command.Connection = this.Connection;         
                return (int)command.ExecuteScalar();      
             }    
             finally     
             {         
                this.Connection.Close();     
             }   
          }
       }
     
       public partial class ResourcesTableAdapter : global::System.ComponentModel.Component 
       {      
          [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]      
          [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")]      
          [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Insert, true)]   
          public virtual int Insert(int ResourceID, string ResourceName, string Description, string Location, string ResourceColor)     
          {          
             this.Connection.Open();      
             try          
             {              
                this.Insert(ResourceName, Description, Location, ResourceColor);              
                OleDbCommand command = new OleDbCommand();               
                command.CommandText = "SELECT @@IDENTITY";               
                command.Connection = this.Connection;              
                return (int)command.ExecuteScalar();          
             }         
             finally          
             {               
                this.Connection.Close();          
             }      
          }      
       }
    }
                                

  20. Build the solution.
  21. Click the SmartTag and select Configure Data Source… on the upper right of the ISDataSource.
  22. Select SchemaType to DataSet and Schema Name to WebScheduler_Movies then click Next.



  23. Make sure the Select, Insert, Update and Delete tab for each table is not empty then click Finish.



  24. Select WebScheduler instance and press F4 to show the WebScheduler’s properties.
  25. Set the following properties:

    Property Value
    DataSourceID ISDataSource1
    CategoriesDataMember Categories
    RecurrenceDataMember RecurrenceInfo
    EventsDataMember Events
    RecurringEventsDataMember RecurringEvents
    ResourcesDataMember Resources



  26. Go to DataBinding and specify the field of CategoryBinding, EventsBinding, RecurrenceBinding, RecurrenceEventsBinding, and ResourcesBinding based on the database field.


     

  27. WebScheduler binding is done. Now you are able to run the project.

    The database is empty so the current WebScheduler will not show any event or resources.
Previous Next