Friday, December 18, 2009

SQL Database compare software

Stumble Upon Toolbar
Here is free databse compare software for Access / MY SQL / Sql Serve , Compare application will allow you to compare the structure of two SQL server databases and display all the differences between them.. The structure viewer is included on same , you can find the comparison and acoording to that you can choose to exclude that comparioson of given fields , constraints .This is a lightweight version compared to version 2.0, it very small and portable.





>Download Here

Wednesday, December 9, 2009

Find Maximum Connections for SQL Server.

Stumble Upon Toolbar
- If you want to know how many connection get happen with your database then you can easily get those number using this technique.

Select @@MAX_Connections as MaxConn

Using this you will get the Max number of connection get allowed on an instance of sql server.

- now if you want to know how many attempted connection are then

Select @@Connections as TotalNumberOfLogin

It will gives you all the number of connection was happen when the sql server get started , that may be a successful or unsuccessful connections also.

- You can also check this all using this system store procedure call

Exec sp_monitor

This will gives you result on when server get running , cpu time , usage , amount of data sending receiving , total number of read write operation done plus is there any error on connection like that .

Friday, December 4, 2009

Format DateTime in Gridview.

Stumble Upon Toolbar
Gridview is using mostly , now i have come up with some small but very important task on how to display Proper date time on Gridview , Basically we are defining standard date time option (date + time) , but some time we only want to display date in this case you can follow the below format.Format Date on Bound Column in Grid View

Suppose you want DOB in short date format without time , then you can simply use DataFormatString ="{0:d}" for Short Date
like this

<asp:BoundField DataField="DOB" HeaderText="DOB" DataFormatString = "{0:d}" />


if you are using above this setting then also it will not work ,coz by default the html encode is turned ON to prevent the Cross site Scripting attack , so for that you need to add one more property as HtmlEncode ="false".


<asp:BoundField DataField="DOB" HtmlEnclode="False" HeaderText="DOB" DataFormatString = "{0:d}" />

if You want Logn Date you can use - DataFormatString = "{0:D}"
if You want Logn Time you can use - DataFormatString = "{0:T}"

If you are using Template comlumn and you want to make your date string in short format then also you can use this suppose your item templates is

<ItemTemplate >
<asp:Label ID="DOB" runat="server" Text='<%# Bind("DOB") % >'> </asp:Label >
</ItemTemplate >


Then also you can use like this way:

<asp:Label ID="DOB" runat="server" Text='<%# Bind("DOB","{0:D}") % >'> </asp:Label >


Following table will show some date formating ways in Gridview column.


















































Format Pattern

Name

Example

d


Short date

11/8/2008

D

Long date

Sunday, August 11, 2008


t

Short time

3:32 PM

T

Long time

3:32:00 PM

f

Full date/time
(short time)

Sunday, August 11, 2008 3:32 PM

F

Full date/time
(long time)

Sunday, August 11, 2008 3:32:00 PM

g

General date/time
(short time)

8/11/2008 3:32 PM

G

General date/time
(long time)

8/11/2008 3:32:00 PM

m or M

Month day

August 11

r or R

RFC 1123


Sun, 11 Aug 2008 8:32:00 GMT

s

Sortable date/time

2008-08-11T15:32:00

u


Universable sortable date/time

2008-08-11 15:32:00z

U

Universable sortable date/time

Sunday, August 11, 2008 11:32:00 PM


y or Y

Year month

August, 2008


thanx you,

Wednesday, November 25, 2009

How to know SQL Server version and Edition

Stumble Upon Toolbar
some time we just install the sql server , but still we don't know which type of version it is and edition also , basically we need that when we are upgrating current version of new version. Current there is sql server 2008 is there in market,

now how to determine which version of sql 2008 is running out machine,
- run the following T-SQL statement,

SELECT SERVERPROPERTY ('productlevel') ,SERVERPROPERTY('productversion'), SERVERPROPERTY ('edition')

you will get the result like :
RTM | 10.0.1600.22 | Enterprise Edition

RTM is product level which means - 'Release To Manufacturing'.
but what is means of RTM - is a stage on which the distribution of process begins CD of
that product get created and retial packs and then product will get shipp , this is very
long process and because of that RTM date is mostly ahead of the final release date.

10.0.1600.22 means product version.

Enterprise Edition means its a Edition there are some other editions are also there like
Developer,standard ,web,Express ,Workgroup , 64- bit Edition .

The following table lists the Sqlservr.exe version number.








Release Sqlservr.exe
RTM 2007.100.1600.0
SQL Server 2008 Service Pack 12007.100.2531.0

Wednesday, November 18, 2009

Check for valid Internet Connection using C#

Stumble Upon Toolbar
on many application we need internet connectio , such as smart client to send receive the data, now in this case below code will help you to make sure that you have proper internet connection or not , the conecpt is like very simple, at first we simply check that if the user has network connection and according to that it will return Success / Fail message.

Now i just ping the two website (www.google.com ,www.yahoo.com) which will ping that site and return fail or success message.


C#
public bool GetIsConnAvail()
{
var success = false;
string StatusMsg;
if (NetworkInterface.GetIsNetworkAvailable() == false)
{
return success;
}
string[] Mysite = { "www.google.com", "www.yahoo.com"};
try
{
using (var ping = new Ping())
{
foreach (var url in Mysite)
{
var replyMsg = ping.Send(url, 300);
if (replyMsg.Status == IPStatus.Success)
{
success = true;
StatusMsg = "Connection Found..."
break;
}
else
{
StatusMsg = "Internet Connection not Found on your machine..."
}

}
}
}

catch (Exception ex)
{
Trace.WriteLine(ex.Message);
}
return success;
}



i thing this code will surely help you to search your connection faster than other ways.

Tuesday, November 10, 2009

video on web2.0

Stumble Upon Toolbar
hi , i just found very nice vodeo on web2.0





another video on web2.0 , its really very informative

Wednesday, November 4, 2009

Generate Sitemap using ASP

Stumble Upon Toolbar
Sitemap is very important factor of web site , you can say its a list of pages of web site accessible to user. it Organize in hierarchical fashion. basically it helps the visitors and mostly on search engine bots to find the perticular page on you site. it improve seo of site , it works just like the dynamic access to site. basically sitemap in xml format.



Here i have created one sample application that can read xsl file and according to that it generate sitemap of your site.
on my Excel file i have place all the links of my sites.
now how to get this ,
1 .open your site say www.google.com
2. now on your web developer toolbar (Mozilla addon) on Information section > click view link information it will open open page and in that you can find all the site links
3. copy that on excel file and save it ,

now write application that read a data from excel and generate sitemap



< %

Const adOpenStatic = 3
Const adLockPessimistic = 2
Dim cnnExcel
Dim rstExcel
Dim I
Dim iCols

Set cnnExcel = Server.CreateObject("ADODB.Connection")
cnnExcel.Open "Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq="&Server.MapPath("1.xls")&";DefaultDir="&Server.MapPath(".")&";" Set rstExcel = Server.CreateObject("ADODB.Recordset")
rstExcel.Open "SELECT * FROM [Sheet1$]", cnnExcel
iCols = rstExcel.Fields.Count
rstExcel.MoveFirst
xmlData = ""
xmlData = xmlData&""
Do While Not rstExcel.EOF
xmlData = xmlData& ""
xmlData = xmlData& ""& rstExcel.Fields.Item(0).Value & "" & vbCrLf
xmlData = xmlData& "
"
rstExcel.MoveNext
Loop
xmlData = xmlData& "
"
Response.Write(xmlData)
rstExcel.Close
Set rstExcel = Nothing

cnnExcel.Close
Set cnnExcel = Nothing
% >

Run this file and view source code of this file , save view source file as a "Sitemap.xml"