Yesterday I managed to pass the Microsoft exam 070-432: Microsoft SQL Server 2008, Implementation and maintenance and thus, earned the Microsoft Certification MCTS: SQL Server 2008, Implementation and Maintenance. Additionally I earned the title of Charter Member for my MCTS on SQL Server 2008.
Microsoft SQL Server 2008 provides many useful features thus forming a powerful RDBMS system suitable not only for the enterprise but for other parties as well. More information regarding SQL Server 2008 can be found on the following link: http://www.microsoft.com/sqlserver/2008/en/us/default.aspx
More information about the Microsoft Certifications for SQL Server 2008 can be found on the following links:
MCTS
http://www.microsoft.com/learning/mcp/mcts/sql/2008/default.mspx
MCITP
http://www.microsoft.com/learning/mcp/mcitp/sql/2008/default.mspx
Read more on this article...
Saturday, October 25, 2008
Friday, October 17, 2008
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value
There are some times where database applications give the above error when trying to convert strings to the datetime format in SQL Server.
This error is related to the default language and consequently the dateformat used by the corresponding SQL Server login.
There are two approaches for avoiding/resolving this issue. The first approach is to include the necessary logic in your database application in order not to depend on the default language setting, but use the ISO date format which is: yyyy-mm-dd hh:nn:ss.
The second approach is to change the default language setting for the specific SQL Server login to "us_english".
By executing the following script in SQL Server you get a list with all the logins and among others, the default language names used by these logins. The relevant column name in the results of this script is the "DefLangName":
--Query that changes the default language to "us_english" for a given SQL Server login:
use [master]
EXEC sp_helplogins
GO
If the default language name for the specific login is different than "us_english", and your application's code does not explicitly handle these date-conversion issues, there is the possibility of getting the conversion error when executing your application. You can easily change this setting to "us_english" by executing the below script:
--Query that changes the default language to "us_english" for a given SQL Server login:
use [master]
ALTER LOGIN"LOGIN_NAME" WITH DEFAULT_LANGUAGE = us_english;
GO
* You have to change the "LOGIN_NAME"string to the desired login name for which you would like to change its default language setting.
* You can also change this setting through SQL Server Management Studio.
Concluding, the safest way to handle dateformat data in database applications, is to setup the default language setting for the relevant SQL Server login to "us_english" and use parameterized queries in your source code. To this end, the date formatting will be automatically handled thus avoiding possible conversion errors.
Hope this helps.
Read more on this article...
This error is related to the default language and consequently the dateformat used by the corresponding SQL Server login.
There are two approaches for avoiding/resolving this issue. The first approach is to include the necessary logic in your database application in order not to depend on the default language setting, but use the ISO date format which is: yyyy-mm-dd hh:nn:ss.
The second approach is to change the default language setting for the specific SQL Server login to "us_english".
By executing the following script in SQL Server you get a list with all the logins and among others, the default language names used by these logins. The relevant column name in the results of this script is the "DefLangName":
--Query that changes the default language to "us_english" for a given SQL Server login:
use [master]
EXEC sp_helplogins
GO
If the default language name for the specific login is different than "us_english", and your application's code does not explicitly handle these date-conversion issues, there is the possibility of getting the conversion error when executing your application. You can easily change this setting to "us_english" by executing the below script:
--Query that changes the default language to "us_english" for a given SQL Server login:
use [master]
ALTER LOGIN
GO
* You have to change the "LOGIN_NAME"
* You can also change this setting through SQL Server Management Studio.
Concluding, the safest way to handle dateformat data in database applications, is to setup the default language setting for the relevant SQL Server login to "us_english" and use parameterized queries in your source code. To this end, the date formatting will be automatically handled thus avoiding possible conversion errors.
Hope this helps.
Thursday, October 16, 2008
Closing a C# Application (including hidden forms)
There are many times when we develop C# applications, where we make use of several forms. To this end, there are times that we are using the Hide() method for some of these forms thus hiding the forms, but not closing or disposing them.
Nevertheless, in the main form of a program we usually make use of an "Exit" button or another similar control. If the even code used behind this control calls the form to be closed or disposed, the application still runs due to the other hidden forms.
In order to totally close a C# application, including the hidden forms, you can use the following command in the event code of the "Exit" control:
Application.Exit();
Read more on this article...
Nevertheless, in the main form of a program we usually make use of an "Exit" button or another similar control. If the even code used behind this control calls the form to be closed or disposed, the application still runs due to the other hidden forms.
In order to totally close a C# application, including the hidden forms, you can use the following command in the event code of the "Exit" control:
Application.Exit();
Read more on this article...
Changing the startup form in a C# project
Open the C# project properties. In the "Application" tab set the Startup object to "WindowsFormsApplication1.Program". The "WindowsFormsApplication1" reflects the name of your current C# project so it could be different than the project name presented here.
Then in the solution explorer, under the project tree, open the "Program.cs" file. The code should be similar as follows:
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
By modifying the "Application.Run(new Form1());" command, you can set the startup form. As an example if you want "Form2" to be set as the startup form your must change the code "Application.Run(new Form1());" to "Application.Run(new Form2());"
Read more on this article...
Then in the solution explorer, under the project tree, open the "Program.cs" file. The code should be similar as follows:
static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
By modifying the "Application.Run(new Form1());" command, you can set the startup form. As an example if you want "Form2" to be set as the startup form your must change the code "Application.Run(new Form1());" to "Application.Run(new Form2());"
Read more on this article...
My first blog entry - Welcome
Well, the time has come to create my own Blog.
After many years of browsing the internet and especially software development blogs for solutions to problems and guides, I believe it is time to share my knowledge with others as well.
In this blog I will post ideas, guides, news and other stuff related (but not limited) to .Net development and SQL Server in terms of development and administration.
Welcome to my blog space!
Read more on this article...
After many years of browsing the internet and especially software development blogs for solutions to problems and guides, I believe it is time to share my knowledge with others as well.
In this blog I will post ideas, guides, news and other stuff related (but not limited) to .Net development and SQL Server in terms of development and administration.
Welcome to my blog space!
Subscribe to:
Posts (Atom)
