Start PageShort introduction to smartDBforms.NET
Products FormProducts table form. Demonstrates: - Foreign key relation - SmartDBLabel - SmartDBLinkedLabel - custom error handling - navigation drop-down list - two-way databinding - linking to another form - ad hoc properties
Employees FormDisplays and edits the Employees database table. Image upload, large text, foreign-key columns,date editing popup calendar. Demonstrates the Clone command button. Localization in Spanish.
SuppliersInteracting with GridView. Placing SmartDBControl in TabStrip MultiView. EmptyDataTemplate template. Using MonitorParameters property.
Region FormSimple example for the Region table. Shows the basic elements of smartDBforms.NET. Standard paging.
Search ExampleDemonstrates: Search form for SelectParameters, wild character, EmptyDataTemplate property, DropDown pager style, hyperlinks as command buttons
ASP.NET AJAXShows how to use smartDBforms.NET with ASP.NET AJAX.
Category FormTable layout, image upload, large text, html editor,custom paging, custom error handling, disable edit insert, id of inserted items, default insert values
|
Products table form. Demonstrates: Foreign key relation, SmartDBLabel, SmartDBLinkedLabel, custom error handling, navigation drop-down list, two-way databinding, linking to another form, ad hoc properties
This form represents the Products database table. A drop-down list at the top is
prefilled with all available products. The SmartDBView form displays the details for
the currently selected product. Initially the data is displayed in ReadOnly mode,
but the user can select the "Edit" or "New" buttons to switch between other form
modes.
SmartDBLinkedLabel is used to detach the labels for the ProductName and ProductID
columns. This allows the label for a column to be displayed at one place and the
value at another. Another similar control is SmartDBLabel. SmartDBLabel is independent
and can exist without a SmartDBControl. SmartDBLabel is used to display the label
for QuantityPerUnit column. The value user interface for QuantityPerUnit column
is handled by a standard TextBox control using two-way databinding.
The SupplierID and CategoryID columns are foreign-keys referencing respectively
Suppliers and Categories tables. In edit mode they are displayed as a drop-down
list. The text of the list items is an sql expression which uses values of the parent table. For the Categories table this expression is "Categories" and for the Suppliers
table the expression is "CompanyName".
For the CateogryID column a hyperlink is displayed in ReadOnly mode that opens the
details for the referenced category. Standard databinding is used to generate the
href attribute of the hyperlink.
For some of the columns a special database trigger exists that restricts their values
to be positive. The "MinimumValue" Ad hoc property has been used to enable this
restriction for the SmartDBControls that represent such fields.
OperationStatus is not used to handle errors but instead they are handled by the
SmartDBView event handlers.
CREATE TABLE [dbo].[Products](
[ProductID] [int] IDENTITY(1,1) NOT NULL,
[ProductName] [nvarchar](40) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[SupplierID] [int] NULL,
[CategoryID] [int] NULL,
[QuantityPerUnit] [nvarchar](20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[UnitPrice] [money] NULL CONSTRAINT [DF_Products_UnitPrice] DEFAULT (0),
[UnitsInStock] [smallint] NULL CONSTRAINT [DF_Products_UnitsInStock] DEFAULT (0),
[UnitsOnOrder] [smallint] NULL CONSTRAINT [DF_Products_UnitsOnOrder] DEFAULT (0),
[ReorderLevel] [smallint] NULL CONSTRAINT [DF_Products_ReorderLevel] DEFAULT (0),
[Discontinued] [bit] NOT NULL CONSTRAINT [DF_Products_Discontinued] DEFAULT (0),
CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED
(
[ProductID] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Products] WITH NOCHECK ADD
CONSTRAINT [FK_Products_Categories] FOREIGN KEY([CategoryID])
REFERENCES [dbo].[Categories] ([CategoryID])
GO
ALTER TABLE [dbo].[Products] CHECK CONSTRAINT [FK_Products_Categories]
GO
ALTER TABLE [dbo].[Products] WITH NOCHECK ADD
CONSTRAINT [FK_Products_Suppliers] FOREIGN KEY([SupplierID])
REFERENCES [dbo].[Suppliers] ([SupplierID])
GO
ALTER TABLE [dbo].[Products] CHECK CONSTRAINT [FK_Products_Suppliers]
GO
ALTER TABLE [dbo].[Products] WITH NOCHECK ADD
CONSTRAINT [CK_Products_UnitPrice] CHECK (([UnitPrice] >= 0))
GO
ALTER TABLE [dbo].[Products] CHECK CONSTRAINT [CK_Products_UnitPrice]
GO
ALTER TABLE [dbo].[Products] WITH NOCHECK ADD
CONSTRAINT [CK_ReorderLevel] CHECK (([ReorderLevel] >= 0))
GO
ALTER TABLE [dbo].[Products] CHECK CONSTRAINT [CK_ReorderLevel]
GO
ALTER TABLE [dbo].[Products] WITH NOCHECK ADD
CONSTRAINT [CK_UnitsInStock] CHECK (([UnitsInStock] >= 0))
GO
ALTER TABLE [dbo].[Products] CHECK CONSTRAINT [CK_UnitsInStock]
GO
ALTER TABLE [dbo].[Products] WITH NOCHECK ADD
CONSTRAINT [CK_UnitsOnOrder] CHECK (([UnitsOnOrder] >= 0))
GO
ALTER TABLE [dbo].[Products] CHECK CONSTRAINT [CK_UnitsOnOrder]
|