Hi i am Naresh, I am a Dotnet Developer From Hyderabad India
Showing posts with label aspdotnet. Show all posts
Showing posts with label aspdotnet. Show all posts
Thursday, May 23, 2013
Asp.Net How to Convert To Different Time Zones Using C#
Here I will Explain How To Get The Server Times Of Different Countries Using C#
Some Times We Come Across Different Date And Time Zones To Display, So By Using The Following Code You Can Get Different Countries Date And Time.
DateTime now = DateTime.Now; //Displays Our System Time
c.Text = "Time is " + now.ToString() + " in your System";
string zoneId = "Central European Standard Time";
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(zoneId);
DateTime result = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi);
a.Text = "Time is " + result + " in Denmark";
string zoneId1 = "India Standard Time";
TimeZoneInfo tzi1 = TimeZoneInfo.FindSystemTimeZoneById(zoneId1);
DateTime result1 = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi1);
b.Text = "Time is " + result1 + " in India";
string zoneId2 = "Central Standard Time";
TimeZoneInfo tzi2 = TimeZoneInfo.FindSystemTimeZoneById(zoneId2);
DateTime result2 = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi2);
c.Text = "Time is " + result2 + " in Chicago";
Output:
Ramayana story narrated by a kid
Hi everyone,
this post is just for fun , i got a mail from my sister and its really funny so thought of sharing with all who visit this blog.
this post is just for fun , i got a mail from my sister and its really funny so thought of sharing with all who visit this blog.
"May be Two years back….one of the proud school in Chennai where all felt admission is impossible. to get UKG admission for my friend’s daughter I too went there. For that admission my friend had studied a lot than his daughter J
The child could not understand why they have bought her there. Principal of the school is like “kadalora kavithai Jenifer” (one of the filmy characters). When I smiled at her, she turned & that moment my friend realized there is no benefit by my presence L
When we are all standing, the school principal started to converse with the child…yes in English only. This is one of most memorable interview I have ever witnessed in my life..
“ “What’s your name?”
“Sarithra”
“Good. Tell me something you know”
“I know many things. Tell me what you want”
Alas, there is no better point for not getting the admission. .Sarithra’s mother was trying to make up the situation but Jenifer stopped..
Turning to child…Jenifer said.. “Tell any rhymes or story which you know”
Again…”Which one you want Rhymes or Story?”
Well done, second wicket too gone. Jenifer was little bit angry about the reply
“Ok. .tell me a story”
“You want to hear what I studied or what I wrote”
Taken to surprise, Jenifer asked “Oh you write stories”
“Why should I not write?”
Now even I was taken aback and whispered to my friend “our whole generation is not going to get admission in this school”
But Jenefier was impressed with the answer, she & including us, would have not heard such a story in our life
“Ok, tell me story which you have written”
Sarithra said “ Ravanan kidnapped Sita to Srilanka”
Opening scene failed to fail an impress Jenifer but still she encouraged the child to continue
“Rama asked Hanuman’s help to rescue Sita. Hanuman too agreed to help Rama”
“Then”
‘“Now, Hanuman called his friend Spider man”.no one expected this twist in the story
“Why?”
“Because there are lot of mountains between India and Srilanka..if we have Spiderman we can go easily with his rope”
“But Hanuman can fly isn’t it”
“Yes. But he is having Sanjeevi Mountain on one hand so he cannot fly very fast”
(I remember Hanuman’s picture in ABT parcel serviceJ)
Now Jenifer is quiet, after a while Sarithra asked “Should I continue or not”..
“Ok ok then”
“Hanuman and Spiderman flew to Srilanka and rescued Sita. Sita said Thanks to both”
“Why”
“When you are helped you should say Thanks”
“Ok Ok then”
“Hanuman now called Hulk.”
All were surprised…she realized our curiosity and said “ Now Sita is there, so to take her safely back to Rama..he called Hanuman”
What logic??? But Jenifer asked…
“Hanuman can carry Sita right?”
“Yes. But he has Sanjeevi Mountain in one hand and has to hold spider man on the other”
Jenifier could not control her smile…”So when they all started to India they met my friend Akshay”
“How come Akshay there now”
“Because its my story and I can bring any one there”
Now Jenifer didn’t get angry but waited for the next twist
“Then all started to India and landed at Chennai Velechery bus stop”
Now I asked “ Why they have landed In Velechery bus stop?”
“Because they forgot the way..& Hulk got an idea and called Dora”
I came to know about Doremon only there…
“Doremon came and she took Sita to Velechery Venus Colony…that’s all”. Finished the story with a smile
Now Jenifer asked “Why venus Colony?”
"Because sita there & am Sita”
Jenifer impressed and embraced the child. She has been admitted in UKG & gifter her with a Doremon doll."
J
Thursday, April 18, 2013
Visual Studio 2008 Expand And Collapse All The Sections Of Code ShortCuts
Some Of ShortCuts That Might Be Useful For .net Developers
CTRL + M + O will collapse all.
CTRL + M + L will expand all.
CTRL + M + P will expand all and disable outlining.
CTRL + M + M will collapse/expand the current section.
These options are also in the context menu under Outlining.
Labels:
Asp.net,
aspdotnet,
Collapse,
collapse/expand,
database,
Expand,
Expand/collapse,
Outlining,
Short Cuts,
Visual Studio 2008
Saturday, April 13, 2013
How to Find The Primary Key And Foreign In A Database
Finding The Primary And Foreign Keys Of All Tables In A Database.
SELECT
K_Table = FK.TABLE_NAME,
FK_Column = CU.COLUMN_NAME,
PK_Table = PK.TABLE_NAME,
PK_Column = PT.COLUMN_NAME,
Constraint_Name = C.CONSTRAINT_NAME
FROM
INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS C
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS FK
ON C.CONSTRAINT_NAME = FK.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS PK
ON C.UNIQUE_CONSTRAINT_NAME = PK.CONSTRAINT_NAME
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE CU
ON C.CONSTRAINT_NAME = CU.CONSTRAINT_NAME
INNER JOIN (
SELECT
i1.TABLE_NAME,
i2.COLUMN_NAME
FROM
INFORMATION_SCHEMA.TABLE_CONSTRAINTS i1
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE i2
ON i1.CONSTRAINT_NAME = i2.CONSTRAINT_NAME
WHERE
i1.CONSTRAINT_TYPE = 'PRIMARY KEY'
) PT
ON PT.TABLE_NAME = PK.TABLE_NAME
Labels:
Asp.net,
aspdotnet,
database,
FOREIGN KEY,
inner join,
join,
primary key,
select,
unique constraint
Monday, April 8, 2013
How To View The Definition Of A Stored Procedure In Sql
To View The Definition Of A Stored Procedure In Transact Sql Using Query Editor
USE DatabaseName;
GO
EXEC sp_helptext N'DatabaseName.dbo.ProcedureName';
Labels:
Asp.net,
aspdotnet,
database,
SQL SERVER,
STORED PROCEDURES,
Transact Sql,
TSql
What Is The Connection String To Connect The Excel File With Extensions .XLS or .XLSX or .CSV in C#, ASP.Net ?
Connection Strings to Read XLS And XLSX And CSV File In C#,ASP.NET
To Upload CSV File:
string CSVconnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strPathofFileCsv + @";Extended Properties='text;HDR=Yes;FMT=Delimited(,)';";To Upload XLS File:
string XLSconnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source= " + strPathofFileXls + ";Extended Properties=\"Excel 12.0;HDR=YES;IMEX=1\"";
To Upload XLSX File:
string XLSXconnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strPathofFileXlsx + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\";";
Labels:
.csv,
.xls,
.xlsx,
2003,
2007,
Asp.net,
aspdotnet,
c#,
Connection Strings,
csv,
Excel To Asp.net,
excel to c#.net,
xls,
xlsx
Saturday, April 6, 2013
How to Delete All Stored Procedure From A Database At a Time
declare cur_dropProc cursor
scroll for
select [name] from sysobjects where xtype='p'
open cur_dropProc
go
Declare @procName varchar(500)
fetch first from cur_dropProc into @procName
while @@fetch_status=0
begin
Exec('drop procedure ' + @procName)
fetch next from cur_dropProc into @procName
end
go
close cur_dropProc
go
deallocate cur_dropProc
Labels:
Asp.net,
aspdotnet,
database,
SQL SERVER,
STORED PROCEDURES,
Transact Sql,
TSql
How To Delete All Tables In A Database Using sql
To Delete All Tables In A Database At a time Using One Query.
USE [database name]
EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"
How To Get All Table Names In A Database Using sql.
Here Is The Best Way To Get All Table Names , Procedure Names , Views etc.., Using Following Query.
SELECT sobjects.name
FROM sysobjects sobjects
WHERE sobjects.xtype = 'U'
And For Other Object Types
C : Check constraint
D : Default constraint
F : Foreign Key constraint
L : Log
P : Stored procedure
PK : Primary Key constraint
RF : Replication Filter stored procedure
S :System table
TR : Trigger
U : User table
UQ : Unique constraint
V : View
X : Extended stored procedure
SELECT sobjects.name
FROM sysobjects sobjects
WHERE sobjects.xtype = 'U'
And For Other Object Types
C : Check constraint
D : Default constraint
F : Foreign Key constraint
L : Log
P : Stored procedure
PK : Primary Key constraint
RF : Replication Filter stored procedure
S :System table
TR : Trigger
U : User table
UQ : Unique constraint
V : View
X : Extended stored procedure
Labels:
aspdotnet,
CHECK CONSTRAINT,
DEFAULT CONSTRAINT,
FOREIGN KEY,
SQL SERVER,
STORED PROCEDURES,
TABLE,
TRIGGERS,
USER TABLE,
VIEW
Subscribe to:
Posts (Atom)
