-- =============================================
-- Author: PC PATEL
-- Create date: 5-Aug-2011
-- Description: Used when updating routes
-- =============================================
CREATE PROCEDURE Usp_makepropertiesvb @TableName VARCHAR(max)
AS
BEGIN
DECLARE @Temp VARCHAR(max)
DECLARE @Temp1 VARCHAR(max)
DECLARE @Variables varchar(max)
set @Variables = ''
DECLARE @Properties varchar(max)
set @Properties = ''
DECLARE CUR1 CURSOR forward_only FOR
SELECT i_s.COLUMN_NAME,
CASE i_s.DATA_TYPE
WHEN 'smallint' THEN 'Integer'
WHEN 'int' THEN 'Integer'
WHEN 'varchar' THEN 'String'
WHEN 'char' THEN 'String'
WHEN 'datetime' THEN 'Date'
END AS DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS AS i_s
LEFT OUTER JOIN sys.extended_properties AS s
ON s.major_id = Object_id(i_s.TABLE_SCHEMA + '.' + i_s.TABLE_NAME)
AND s.minor_id = i_s.ORDINAL_POSITION
AND s.name = 'MS_Description'
WHERE ( Objectproperty(Object_id(i_s.TABLE_SCHEMA + '.' + i_s.TABLE_NAME), 'IsMsShipped') = 0 )
AND ( i_s.TABLE_NAME = @TableName )
ORDER BY i_s.ORDINAL_POSITION
FOR READ ONLY
OPEN CUR1
FETCH NEXT FROM CUR1 INTO @Temp, @Temp1
WHILE @@FETCH_STATUS = 0
BEGIN
SET @Variables += 'Private _' + @Temp + ' As ' + @Temp1 + CHAR(10)
set @Properties += 'Public Property ' + @Temp + '() As ' + @Temp1 + CHAR(10)
set @Properties += 'Get' + CHAR(10)
set @Properties += 'Return _' + @Temp + CHAR(10)
set @Properties += 'End Get' + CHAR(10)
set @Properties += 'Set(ByVal value As ' + @Temp1 + ')' + CHAR(10)
set @Properties += '_' + @Temp + ' = value' + CHAR(10)
set @Properties += 'End Set' + CHAR(10)
set @Properties += 'End Property' + CHAR(10)
FETCH NEXT FROM CUR1 INTO @Temp, @Temp1
END
CLOSE CUR1
DEALLOCATE CUR1
print '#Region " Variables "'
print @Variables
print '#End Region'
print '#Region " Properties "'
print @Properties
print '#End Region'
END
Subscribe to:
Post Comments (Atom)
-
Remarks This property specifies the appearance of the embedded Windows Media Player. When uiMode is set to "none", "mini...
-
<body> <form id="form1" runat="server"> <img class="RibbonL" src="Imag...
-
Partial Class Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Lo...
What is the use of n-tier architecture and 3-tier architecture?
how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...
No comments:
Post a Comment