While it has become common practice for developers to manipulate VB.NET date/time values manually, it's never a good idea because the result is rarely a correct date/time value. Whenever you try to use your own calculation routines for adding and subtracting date/time values, you risk generating a bug since it's hard to check the code for all possible outcomes, whereas utilizing appropriate .NET objects and methods is sure to provide correct results.
As you can see here
Private Sub AddDateTime()
Dim dtNow As Date = Now()
MsgBox(dtNow)
dtNow = dtNow.AddYears(20)
MsgBox(dtNow) the Date object provides for simple manipulation that allows you to add and subtract date/time values in VB.NET.
dtNow = dtNow.AddMonths(10)
MsgBox(dtNow)
dtNow = dtNow.AddDays(3)
MsgBox(dtNow)
dtNow = dtNow.AddHours(5)
MsgBox(dtNow)
dtNow = dtNow.AddMinutes(2)
MsgBox(dtNow)
dtNow = dtNow.AddSeconds(6)
MsgBox(dtNow)
dtNow = dtNow.AddMilliseconds(4)
MsgBox(dtNow)
dtNow = dtNow.AddYears(-2)
MsgBox(dtNow)
End Sub
the Date object provides for simple manipulation, which allows you to add and subtract date/time values in VB.NET. In the example, I define the Date variable dtNow and set it to the current date/time value. I utilize these Date object methods to manipulate the date: AddYears, AddMonths, AddDays, AddHours, AddMinutes, AddSeconds, and AddMilliseconds. For each method, I specify the number of years or months or hours to add. Subtraction is done by passing a negative value to the method. Notice that these methods will never result in an impossible date; manual manipulation cannot guarantee such results.
Search Results:
Wednesday, July 22, 2009
Thursday, July 16, 2009
Increase timeout in dataset
Tuning your SQL queries for the best performance can be part of life when you’re writing a database application. Sometimes life is hard, and you just can’t get things running as quickly as you’d like. With the default command time-out at 30 seconds, how do you use a TableAdapter to execute methods without timing out and failing? Turns out, it’s pretty easy. If you have a DataSet called MyDataSet.xsd, add code to the MyDataSet.vb partial class file:
Hopefully you'll find my first post useful!<
Imports System.Data.SqlClientWhen it comes time to call a long query, just call the SetCommandTimeOut method before the query:
Namespace MyDataSetTableAdapters
Partial Class CustomersTableAdapter
Public Sub SetCommandTimeOut(ByVal timeOut As Integer)
For Each command As SqlCommand In Me.CommandCollection
command.CommandTimeout = timeOut
Next
End Sub
End Class
End Namespace
Dim ds As New MyDataSetThis will change the time-out for all of the commands on the instance of the TableAdapter, so be sure to set it back to a lower value once you’re done with the long query
Dim customersTA As New MyDataSetTableAdapters.CustomersTableAdapter
' Increase time-out to 60 seconds
customersTA.SetCommandTimeOut(60000)
' Do the slow query
customersTA.FillSlowQuery(ds.Customers)
Hopefully you'll find my first post useful!<
Tuesday, July 14, 2009
Thursday, July 2, 2009
Hide Files in an Image.
Here are simple steps to hide files in images.
1. Gather all the files that you wish to hide in a folder anywhere in your PC (For Example:- If the files are in C:\temp).
2. Now, add those files in a RAR archive (e.g. secret.rar). This file should also be in the same directory (C:\temp).
3. Now, look for a simple JPEG picture file (e.g. logo.jpg). Copy/Paste that file also in C:\temp.
4. Now, open Command Prompt (Go to Run and type ‘cmd‘). Make your working directory C:\temp.
5. Now type: “COPY /b logo.jpg + secret.rar output.jpg” (without quotes) - Now, logo.jpg is the picture you want to show, secret.rar is the file to be hidden, and output.jpg is the file which contains both.
6. Now, after you have done this, you will see a file output.jpg in C:\temp. Open it (double-click) and it will show the picture you wanted to show. Now try opening the same file with WinRAR, it will show the hidden archive .
1. Gather all the files that you wish to hide in a folder anywhere in your PC (For Example:- If the files are in C:\temp).
2. Now, add those files in a RAR archive (e.g. secret.rar). This file should also be in the same directory (C:\temp).
3. Now, look for a simple JPEG picture file (e.g. logo.jpg). Copy/Paste that file also in C:\temp.
4. Now, open Command Prompt (Go to Run and type ‘cmd‘). Make your working directory C:\temp.
5. Now type: “COPY /b logo.jpg + secret.rar output.jpg” (without quotes) - Now, logo.jpg is the picture you want to show, secret.rar is the file to be hidden, and output.jpg is the file which contains both.
6. Now, after you have done this, you will see a file output.jpg in C:\temp. Open it (double-click) and it will show the picture you wanted to show. Now try opening the same file with WinRAR, it will show the hidden archive .
Tuesday, June 30, 2009
Do you Believe in Shiridi sai baba ?

Hi Friends,
Here is a website where you can ask saibaba a question and he will answer you. If you have belief in shri Shiridi SaiBaba then you might be aware of a book which will have all the answers of saibaba and you randomly take a page and choose the solution.Please click the link below to findout more and try it!
Ask sri sai baba
Sql Problem.
Hi Friends,
Today i have experienced a wierd problem with the stored procedure on my Sql server 2005. The stored procedure works fine for some time and later on it gives me a time out.But when i try to recompile the stored procedure it works fine. I thought to find a permanent solution for this. I have found some solution which works for now. I have to check if this problem is solved or it still persists.
I will update the blog if this worked.
1)DBCC FREEPROCCACHE --this flushes out the procedure caches
2)DBCC FLUSHPROCINDB (dbid) --recompiles all SPs in the database
In order to get the dbid we can use a simple select statement as shown below.
SELECT DB_ID('databasename') as [Database ID].
**Keep checking the blog for updates.
Today i have experienced a wierd problem with the stored procedure on my Sql server 2005. The stored procedure works fine for some time and later on it gives me a time out.But when i try to recompile the stored procedure it works fine. I thought to find a permanent solution for this. I have found some solution which works for now. I have to check if this problem is solved or it still persists.
I will update the blog if this worked.
1)DBCC FREEPROCCACHE --this flushes out the procedure caches
2)DBCC FLUSHPROCINDB (dbid) --recompiles all SPs in the database
In order to get the dbid we can use a simple select statement as shown below.
SELECT DB_ID('databasename') as [Database ID].
**Keep checking the blog for updates.
Subscribe to:
Posts (Atom)