Tuesday, April 8, 2008

How to add AdRotator in ASP.NET using VB.NET

AdRotator is used to randomize pictures (images) whenever you load or refresh a web page. To add an AdRotator you simply have to drag a adrotator from toolbox and place it on your ASP.NET page. Then you have to add an xml file. The attributes of the xml file will be the following:

<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>

<Ad>
<ImageUrl>Pix/yarn/1.gif</ImageUrl>
<AlternateText>Image is not displayed</AlternateText>
</Ad>

<Ad>
<ImageUrl>Pix/yarn/2.jpg</ImageUrl>

<AlternateText>Image is not displayed</AlternateText>
</Ad>

<Ad>
<ImageUrl>Pix/yarn/3.jpg</ImageUrl>
<AlternateText>Image is not displayed</AlternateText>
</Ad>
</Advertisements>


Now save the file with as "Ads.xml" and go back to your ASP.NET Page where you have place that AdRotator and give "Ads.xml" as a value to its AdvertisementFile attribute.

Run the page and you will see the images.

Sunday, April 6, 2008

HOW TO EMBED(ATTACH) CRYSTAL REPORT IN ASP.NET USING VB.NET

In this article I am going to describe you that how can you embed(attach) a crystal report in ASP.NET using VB.NET as a language. To embed a crystal report first you have to select a crystalreportviewer from Toolbox in ASP.NET environment and then you have to right click on the ASP.NET page and click on View Code option. When the view code page will open you will insert the following code.

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub btnReportGenerate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReportGenerate.Click
Try
Dim path As String
path = Server.MapPath(Request.ApplicationPath)
Dim report As New ReportDocument
report.Load(path + "\zreport.rpt")
report.SetDatabaseLogon("sa", "52xMAX")
CrystalReportViewer1.ReportSource = report
Response.Write("report launch successfully")
Catch ex As Exception
Response.Write("Error: " & Err.Description)
End Try
End Sub

End Class

Further if you want to add a parameter to the crystal report so that only the desired data will be print then you have to use this code. But Before that you have to insert text boxes on your ASP.NET so that you will pass the selective data to the crystal report. I am writing here the VB.NET Code, you have to insert text box by your self.

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Partial Class _Default
Inherits System.Web.UI.Page


Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
crystalreportshow.Visible = False
ElseIf IsNothing(txtID.Text) Then
crystalreportshow.Visible = False
ElseIf Not IsNumeric(txtID.Text) Then
crystalreportshow.Visible = False
End If
End Sub

Protected Sub btnReportGenerate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnReportGenerate.Click
Try
If IsNothing(txtID.Text) Then
Response.Write("Id must be filled")
ElseIf Not IsNumeric(txtID.Text) Then
Response.Write("ID must be in numeric")
Else
crystalreportshow.Visible = True
phase1.Visible = False
Dim path As String
path = Server.MapPath(Request.ApplicationPath)
Dim report As New ReportDocument
report.Load(path + "\zreport.rpt")
report.SetDatabaseLogon("sa", "52xMAX")

Dim crParameterFieldDefinitions As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions = report.DataDefinition.ParameterFields
Dim crParameter1 As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition = crParameterFieldDefinitions.Item("id")

Dim crparameter1value As CrystalDecisions.Shared.ParameterValues = crParameter1.CurrentValues

Dim disval As New CrystalDecisions.Shared.ParameterDiscreteValue

disval.Value = txtID.Text

crparameter1value.Add(disval)

crParameter1.ApplyCurrentValues(crparameter1value)

CrystalReportViewer1.ReportSource = report
Response.Write("report launch successfully")

End If
Catch ex As Exception
Response.Write("Error: " & Err.Description)
End Try
End Sub
End Class


In this way you can insert as many parameter as you can. Remember that parameter will select there data type as you pass the data to the report.

I hope that this will help you.

Monday, March 31, 2008

How to open URL of web.sitemap in a new window

Dear friends,

You can open a link of your web.sitemap available in VS 2005 in a new window by writing the following code:

<siteMapNode url="javascript: var w=window.open('http:\\www.google.com.pk');" title="GOOGLE" description="" />

I hope that will help you.

Tuesday, March 18, 2008

Network Printers is not accessed

Problem:
Some time network printers are not accessed from your computer. While they are accessed from other network clients.

Cause:
Your computer is actually not accessing the network computer through which the printer is attached.

Solution:
Access that remote computer first by following these steps:
1) Click on My Network Places Icon displayed on your desktop.
2) Double click on Entire Network Icon
3) Double click on Microsoft Windows Network Icon
4) Double Click on your network icon
5) Double click on that network computer withwhom printer is attached
6) Enter Username and password and press ok button

You can now access the printer which you were desired to access a few seconds ago.

USB Drive Icon not Show in My Computer

Some times our USB drive is loaded but its icon is not displayed? What to do in this case?

Cause:
This problem occurs when your drive letters are conflicting. Windows does not show the message either it load the USB drive and the drive with the same letter also work fine.
Solution:
Go to CONTROL PANEL -> Administrative Tools -> Computer Management -> Storage -> Disk Management.
Inside it you can see your USB drive. Right click on it and choose "change drive letter and path" from the popup menu. In this you will see an edit button. Click on edit button. Change the drive letter and click ok button and exit from the menu.

You will see the drive in your My Computer and also in Windows Explorer now.

Friday, March 14, 2008

HOW TO BUILD A LAN

Overview Building your own Ethernet LAN (local area network) is not nearly as difficult as it may seem. Using features from your OS and some special hardware (including cables, NICs, a hub/router, and an Internet connection), you can easily, and quickly, build a nifty home network complete with Internet access and file-sharing capabilities. The necessary hardware is easily obtained, and reasonably priced, making an Ethernet LAN possible for anyone with multiple computers, and the need to network them.

General Information A clear understanding of a LAN, as well as its limitations, is very helpful when considering the structure of your Ethernet LAN. You’ll need to decide on the physical structure that is best-suited for your networking needs. Visit SearchNetworking.com to read their definition of a LAN and information about LAN network technologies, hardware, and implementation strategies. General LAN information described in non-technical terms is available at the Web site http://en.wikipedia.org/wiki/LAN . A brief essay about building a LAN can be found on the Web page www.johnscloset.net/lan/. This essay describes the hardware and configuration of an Ethernet LAN that allows the computers on the network to share an Internet connection. This essay is just one part of a networking primer that contains discussions about LANs, WANs, and hardware.

LAN Resources Possibly the best sources for information about networking, Ethernet, and LANs is one of the many LAN tutorials found on the Web. LAN tutorial sites are listed below.

* http://www.lantronix.com/learning/
* developer.intel.com/design/network/
* www.howstuffworks.com/home-network.htm
* http://compnetworking.about.com/

LAN Hardware and Software The number of households with more than one PC is growing each year. The need for communication between these PCs and shared devices, such as printers and hard drives, has spawned a large market for network hardware. Consumers are faced with a variety of choices, from running Cat-5 cables between PCs, to wireless access.

The basic building blocks of simple and inexpensive LAN are a hub/router, Cat-5 cabling, and NIC for each computer on the network. You can check the price and availability of these items at Web sites such as www.pricewatch.com/ and outpost.com/. Both of these sites allow you to compare different products and purchase the products that you choose. The Web site www.starmicrotech.com/ specializes in selling network products. It’s a great source for LAN hardware.

Additional Links For an interesting perspective on LAN gaming, visit www.gideontech.com/. This site provides information about LAN parties--communities of gamers within a LAN who play interactive games, complete with instant messaging. Are you looking for a good book about building a high-speed LAN? Visit the page http://compnetworking.about.com/ for several recommended books about building LANs.

Tuesday, March 11, 2008

SOME PROBLEMS THAT OCCURRED OFTENLY OR USUALLY

1) Write on “D:\BACKUP” failed, status = 112. See the SQL Server error log for more details. BACKUP DATABASE is teminating abnormally.

Solution:

This error occur where there is less memory on your harddisk partition where you want to place your backup. So remove / shift unnecessary Items/files/folders and then store the backup in that drive.


2) Some times Excel.exe automatically closed in a few seconds/minutes after loading? What to do then?

Solution:

Just go to start  Run and type excel.exe /safe. It will work fine then.

Docker Tutorial

 I have listed all the necessary commands of Docker below. In case if any is missing or if any improvement required, please share in comment...