Thursday, January 17, 2008
Getting Time part only from SQL DateTime Value
I have seen many people struggling with datetime fields in their programming life. Some people face problems getting the date only from datetime field. If you are one who is struggling please read my article on April 2007.
In this article I would like to mention how you can get the time only from a datetime value.
SELECT CAST(CAST(GETDATE() AS FLOAT) - FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)
Here what I am doing is simply casting the datetime value returned by GETDATE() into FLOAT then I am substracting the full value (value without the fractions) from that. So I will get the fraction part of the float value.
Note that when you cast a datetime value to a float, the full part represents the date and the fraction part represents the time.
2008-01-18 18:22:15.640
39463.7654587963
Then I will cast the result back to the datetime which brings me the time.
This method of casting datetime value to a float value is always handy when working with datetime values.
Friday, January 04, 2008
Inserting a Double Quote in to a String in .NET
VB.NET
Dim str As String = "Example String " & """" & "This is the String with double quotes." & """"
MessageBox.Show(str)
In VB.Net you can indicate that there is a double quote in a string by using 4 double quotes ("""").
C#.NET
string str = "Example String " + "\"" + "This is the String with double quotes." + "\"";
MessageBox.Show(str);
As you will notice in C# the double quote can be represented as double quote, back slash and again using two double quotes ("\"").
The above string will be displayed as follows.
Friday, December 28, 2007
Microsoft Office Mobile 6.1
Additionally it will have the following features,
• Enhanced viewing experience for charts in Excel Mobile.
• Ability to view SmartArt in PowerPoint Mobile.
• Ability to view and extract files from compressed (.zip) folders.
as Microsoft has quoted.
Download it from Microsoft using the following link.
http://www.microsoft.com/downloads/details.aspx?familyid=4b106c1f-51e2-42f0-ba32-69bb7e9a3814&displaylang=en&tm
Thursday, December 20, 2007
Try Your Flying Skills
http://www.creativesql.co.uk/flightgame
See how many miles that you can fly :-).
Happy Flying.
Wednesday, December 19, 2007
KITT is Back
Monday, December 17, 2007
Adding an existing Dataset to a project - VS.NET 2003
If you did then you may have noted that it will only add the files having the extensions .xsd (designer file) and .xsx (resource file) to the project, it will not add the .vb (class file). As a result you will not be able to use the added dataset. Also if anyone tries to add the class file again manually then it will be there as a separate class. Even though this works fine it will be misleading at a latter stage of the projects life. (In the following image you can see the 'dsDataset1.vb' file separately.)
- First open the dataset designer using Visual Studio (double click on the dataset).
- Then right click on the dataset designer and select the 'Generate Dataset' menu option.
Tuesday, December 04, 2007
Detecting Whether the Application is Already Running
Using this post I am going to share the solution with you all, showing how you can determine whether your application is already running in the computer. By detecting this either you can stop starting of the second instance of the application and activate the already running application for the user or you can attempt to close the earlier application and start the new one. If you does not check this then multiple applications might start and the user might complain about the application performance. Also this may cause problems occurring from locked resources.
* Visual Basic (VB)
Using VB you can easily check this by using the App object.
------------------------------------------------------------
If App.PrevInstance = True Then
MsgBox("The program '" & App.EXEName & "'is already running. Please use the running application.")
End
End If
------------------------------------------------------------
* Visual Basic .NET (VB.NET)
Using VB.NET you can do this by using Diagnostics.Process class.
------------------------------------------------------------
If Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess().ProcessName).Length > 1 Then
Application.Exit()
End If
------------------------------------------------------------
Microsoft SQL Server Compact 3.5 for Windows Mobile
- Side-by-side installation together with SQL Server 2005 Compact Edition (version 3.1)
- Support for newer and more secure encryption algorithms
- Additional timestamp (rowversion) data type
- Enhanced support for Transact-SQL statements including:
- Nested query in FROM clause
- CROSS APPLY and OUTER APPLY
- CAST and DECIMAL
- SET IDENTITY INSERT
- TOP CLAUSE
To download and learn more visit Microsoft using the following URL.
Tuesday, October 16, 2007
First Delivery of Airbus A380
Monday, October 08, 2007
Microsoft Flight Simulator X
Friday, October 05, 2007
Microsoft HealthVault
Above all this service is provided free by Microsoft.
Try it out by paying a visit to Microsoft.
http://search.healthvault.com/hvindex.htm?rmproc=true
Thursday, September 27, 2007
Executing .NET Applications Located on a Remote Location
The normal process is to setup your application on both machines and tell them to use. But the problem is that you are not yet finished development so constatly there will be updates to the application. So if you install in two machines, all the time you change the application you have to install the new version in both machines. (This is ok as you think because it is only two machines, but think is there are 50 users using in 50 machines.)
In this kind of a scenario, installing the application in one machine and sharing it and making the other user access the same installation can ease your life. Isn't it?
If you just try running the application from the remote location, application might not work correctly. This is because you have to set a code group for the remote application in the local machine. Then only the local .NET classes will be accessible without problem to the remote application. To configure the things follow the points.
1. Install your required application in one machine and share the application folder if possible. (It doesn't really matter whether it is shared or not. What matters is the accessibility to the folder.) Run the application from the installed machine first to make sure the application is working properly in the local environment.
2. Install the required .NET framework on all the client (user) machines. (In my scenario above, in both uiser machines.) This is because the application is actually ran on the users machine even though it is located on a remote machine.
3. Browse to the application installation folder from a client (user) machine.
Get the 'Run' window by clicking on Start -> Run. Type the machine name or IP address of the machine where your application is installed (Note that my application resides in the machine having the IP 192.168.1.165 in my LAN).If the login criteria is asked, enter them and login. It is ok even if you use the 'Guest' account to log into the system if you have access to the shared application by the guest.
4. Open the .NET Configuration window by clicking on Start -> Control Panel -> Administrative Tools -> Microsoft .NET Framework x.x Configuration.
5. Expand the 'Runtime Security Policy' node from the left hand pane. Then expand the 'Enterprise' node and finally 'Code Groups' node. Then right click on 'All_Code' and click on New....
6. Specify a Name and Description for the code group and click Next.
7. Choose the condition type of the code group as 'URL'. In the underneath URL text box type the path to the remote application folder and put a backslash and an asterisk . In my case I typed file://192.168.1.165/Bin/* (The asterisk is used to include all the items under the folder Bin into the code group that we are creating). Then press Next.
8. From the list of existing permission sets select 'LocalIntranet' and click Next. Then click Finish in the next screen to finish and setup the new code group.
9. Now the code group is created for our remote application. But to make the application really run you have to change one property in the Code Group Properties. Continue by right clicking on the new code group that we created named 'My Code Group' and selecting 'Properties'. 10. In the code group properties, check the 'Policy levels below this level will not be evaluated' check box and press 'Ok' to apply the setting.11. Close the open .NET Configuration windows and launch the application from the share.
If any specific functionality or if the entire application is not working please contact me, I might be able to help you out of the problem.
-
If you are wondering a way to change the column header appearing in the .Net GridView control in run time then this post will help you to ge...
-
Last week I spent few hours to figure out why Samsung Galaxy S2 was not connecting to Samsung Kies through USB cable. I could browse phone c...