Posts

Showing posts from May, 2008

Number of Days in Current Month

This Query to get number of days in Specific month at Specific Year : select to_number(to_char(last_day(to_date('01/02/2008','DD/Mm/yyyy')),'DD')) as days from dual you have to replace date '01/02/2008' with the date you want or the date from sysdate Thanks,

Manage Your Database Connection

This is an Example for how to manage a SQL Server database Connection using Visual Web Developer 2005 Dim _CON As String = "Data Source=MOHAMEDSAMI-PC\SQLEXPRESS;Initial Catalog=Test;Integrated Security=True" Here this is the Connection String and I will tell you in another blog how you can get this String easily, cause it is the most important thing, if you write the right connection you will have a successful connection to the database. Data Source = Your Database Instance, you can type it in many ways like (. /SQLEXPRESS, localhost/SQLEXPRESS, machine name/SQLEXPRESS). Initial Catalog = Your Database Name. Public newSqlConnection As SqlConnection = New SqlConnection(_CON) I defined a new Object from SqlConnection so I can manage and establish the Connection. I have to open the Connection so I can execute any Query I want. Private Function OpenConnection() As Boolean Try                newSqlConnection.Open()    ...