Use the following Link..
http://geekswithblogs.net/dotNETvinz/archive/2009/06/04/adding-dynamic-rows-in-gridview-with-textboxes.aspx
Aug 27, 2011
Insert Into Select Query Sample - Use for Insert Multiple Transaction Entries
'Use for Insert Multiple Transaction Entries
INSERT INTO abd_emp_degree
(deg_emp_userid,
deg_name,
deg_display,
deg_addedby,
deg_addedon)
SELECT 'AW999000',
VALUE,
'Y',
'AW999000',
Getdate()
FROM dbo.Split('CC,PS', ',')
INSERT INTO abd_emp_degree
(deg_emp_userid,
deg_name,
deg_display,
deg_addedby,
deg_addedon)
SELECT 'AW999000',
VALUE,
'Y',
'AW999000',
Getdate()
FROM dbo.Split('CC,PS', ',')
Aug 26, 2011
Create proerties and Declare variable through MsSql Store Procedure , thanks to PC PATEL
-- =============================================
-- 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
-- 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
Aug 25, 2011
How to select table column name and datatype in Ms Sql
SELECT i_s.table_name
AS
[Table Name],
i_s.column_name
AS [Column Name],
i_s.data_type
AS [Data Type],
Isnull(Isnull(i_s.character_maximum_length, i_s.numeric_precision), '')
AS
[Max Length],
Isnull(s.VALUE, '')
AS DESCRIPTION
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 = 'v_QTW_EMPProfile' )
ORDER BY [Table Name],
i_s.ordinal_position
AS
[Table Name],
i_s.column_name
AS [Column Name],
i_s.data_type
AS [Data Type],
Isnull(Isnull(i_s.character_maximum_length, i_s.numeric_precision), '')
AS
[Max Length],
Isnull(s.VALUE, '')
AS DESCRIPTION
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 = 'v_QTW_EMPProfile' )
ORDER BY [Table Name],
i_s.ordinal_position
Aug 10, 2011
How to Get Treeview selected node in javascript
To start with I have added a simple ASP.Net TreeView and a button on my ASPX Page
Now here’s the script that will get the reference of the TreeView selected node and also extract its Text and Value part.
On Page Load In Vb.net
<div>
<asp:TreeView ID="TreeView1" runat="server">
<SelectedNodeStyle ForeColor="Black" />
</asp:TreeView>
</div>
<asp:Button ID="Button1" runat="server" Text="GetSelectedNode" OnClientClick="return GetSelectedNode();" />
Now here’s the script that will get the reference of the TreeView selected node and also extract its Text and Value part.
<script type="text/javascript">
function GetSelectedNode() {
var treeViewData = window["<%=TreeView1.ClientID%>" + "_Data"];
if (treeViewData.selectedNodeID.value != "") {
var selectedNode = document.getElementById(treeViewData.selectedNodeID.value);
var value = selectedNode.href.substring(selectedNode.href.indexOf(",") + 3, selectedNode.href.length - 2);
var text = selectedNode.innerHTML;
alert("Text: " + text + "\r\n" + "Value: " + value);
} else {
alert("No node selected.")
}
return false;
}
</script
On Page Load In Vb.net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
If Not IsPostBack Then MakeTree1()
tvMenu.CollapseAll() End If
Catch ex As ExceptionEnd Try
lblMsg.ForeColor = Drawing.Color.Red
lblMsg.Text = "Error on page."
End Sub
If Not IsPostBack Then MakeTree1()
tvMenu.CollapseAll() End If
Catch ex As ExceptionEnd Try
lblMsg.ForeColor = Drawing.Color.Red
lblMsg.Text = "Error on page."
End Sub
Aug 9, 2011
Simple Cursor in Sql Sqerver/ How to use cursor in MS Sql Server
ALTER PROCEDURE Usp_removrights @userList VARCHAR(MAX),
@menu SMALLINT,
@submenu SMALLINT,
@subsubmenu SMALLINT
AS
DECLARE @count INT
SET @count=0
DECLARE @user_no VARCHAR(MAX)
DECLARE @user_id VARCHAR(MAX)
BEGIN TRY
--Find out the cursors that are opened and not close
SELECT @count = COUNT(*)
FROM sys.Dm_exec_cursors(0)
WHERE is_open = 1
AND name = 'cur_RemovRight'
IF ( @count > 0 )
BEGIN
CLOSE cur_removright;
DEALLOCATE cur_removright;
END
DECLARE cur_removright CURSOR FOR
SELECT VALUE
FROM
dbo.Split('00011 ,00261 , 01014 , 01019 , 01022 , 80011 , 80012 , 80013 , 80014 ', ',')
OPEN cur_removright
FETCH NEXT FROM cur_removright INTO @user_no;
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @user_id = muser_userid
FROM infoview
WHERE muser_empno = @user_no
INSERT INTO userlevelrights1
(userid,
menu,
submenu,
subsubmenu)
VALUES (@user_id,
@menu,
NULL,
NULL)
PRINT @user_id
--Delete from userlevelrights1 where userid=@user_id
FETCH NEXT FROM cur_removright INTO @user_no;
END
CLOSE cur_removright;
DEALLOCATE cur_removright;
END TRY
BEGIN CATCH
INSERT INTO errorlog_sp
SELECT Error_number() AS errornumber,
Error_severity() AS errorseverity,
Error_state() AS errorstate,
Error_procedure() AS errorprocedure,
Error_line() AS errorline,
Error_message() AS errormessage,
Getdate()
RAISERROR ('Error catch',
10,
1)
END CATCH
@menu SMALLINT,
@submenu SMALLINT,
@subsubmenu SMALLINT
AS
DECLARE @count INT
SET @count=0
DECLARE @user_no VARCHAR(MAX)
DECLARE @user_id VARCHAR(MAX)
BEGIN TRY
--Find out the cursors that are opened and not close
SELECT @count = COUNT(*)
FROM sys.Dm_exec_cursors(0)
WHERE is_open = 1
AND name = 'cur_RemovRight'
IF ( @count > 0 )
BEGIN
CLOSE cur_removright;
DEALLOCATE cur_removright;
END
DECLARE cur_removright CURSOR FOR
SELECT VALUE
FROM
dbo.Split('00011 ,00261 , 01014 , 01019 , 01022 , 80011 , 80012 , 80013 , 80014 ', ',')
OPEN cur_removright
FETCH NEXT FROM cur_removright INTO @user_no;
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @user_id = muser_userid
FROM infoview
WHERE muser_empno = @user_no
INSERT INTO userlevelrights1
(userid,
menu,
submenu,
subsubmenu)
VALUES (@user_id,
@menu,
NULL,
NULL)
PRINT @user_id
--Delete from userlevelrights1 where userid=@user_id
FETCH NEXT FROM cur_removright INTO @user_no;
END
CLOSE cur_removright;
DEALLOCATE cur_removright;
END TRY
BEGIN CATCH
INSERT INTO errorlog_sp
SELECT Error_number() AS errornumber,
Error_severity() AS errorseverity,
Error_state() AS errorstate,
Error_procedure() AS errorprocedure,
Error_line() AS errorline,
Error_message() AS errormessage,
Getdate()
RAISERROR ('Error catch',
10,
1)
END CATCH
Subscribe to:
Posts (Atom)
-
Bootstrap css front-end framework. jQuery fast, small, and feature-rich JavaScript library. DataTables advanced interaction contro...
-
click on below link to send sms http://www.eggheadcafe.com/community/asp-net/17/10281633/code-to-send-sms-using-webservice-like-way2sms.as...
-
// use the following event in Your script tag function pageLoad(sender, args) { if (args.get_isPartialLoad()) { //alert(...
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 ...