Tuesday, 29 November 2016

Advanced indexing techniques used in warehouses..

Hi All,

Traditional access methods are b-trees, hash tables and grid files (lot more..)

Inverted indexes (lists), bit map indexed and join indexes are common in warehouses.

Block your website from search engine indexing

Hi All,

It is a common question asked from web administrators.
Use robots.txt file in your root folder of website/webserver

robots.txt


Web site admins use the /robots.txt file to follow instructions about their website to web robots; this is known as The Robots Exclusion Protocol.

It works likes this: a robot wants to visit a Web site URL, say http://www.abc.com/welcome.html. Before it does so, it firsts checks for http://www.abc.com/robots.txt, and finds:

User-agent: *
Disallow: /

When the search engine encounter such a line, the indexing will be stopped.

Friday, 25 November 2016

How to Upload a file using VB.NET

Hi All,

It is very important to upload file to specific folders in Server.
At first you design one page with a FileUpload control, Label Control and Button Control as given below

Main.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Main.aspx.vb" Inherits="Main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    Welcome to Admin Home
    </div>

 
    <asp:FileUpload ID="FileUpload1" runat="server" />
    <asp:Button ID="Button1" runat="server" Text="Upload" />
    <asp:Label ID="Label1" runat="server"></asp:Label>
    <br />
    </form>
</body>
</html>

---------------------------------------------------------------------------------------------------------------------
As a next step click the Button Control and add the code in the Main.aspx.vb file

Main.aspx.vb


Partial Class Main
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
     
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        If FileUpload1.HasFile Then
            Try
                FileUpload1.SaveAs("C:\HUPUploads\" & _
                    FileUpload1.FileName)
                Label1.Text = "File name: " & _
                    FileUpload1.PostedFile.FileName & "<br>" & _
                    "File Size: " & _
                    FileUpload1.PostedFile.ContentLength & "<br>" & _
                    "Content type: " & _
                    FileUpload1.PostedFile.ContentType & "<br>" & _
                    "Location Saved: C:\Uploads\" & _
                    FileUpload1.FileName
            Catch ex As Exception
                Label1.Text = "ERROR: " & ex.Message.ToString()
            End Try
        Else
            Label1.Text = "You have not specified a file."
        End If
    End Sub
End Class


---------------------------------------------------------------------------------------------------------------------
NB: Make sure that you have a folder in C drive as "HUPUploads"




Saturday, 19 November 2016

UpdateCommand in VB.NET

Hi All,
See the code for UpdateCommand. This is almost similar to Delete command.
If you have more fields in the table to update then the UpdateCommand in the code will look like
  UpdateCommand="UPDATE HUPTable SET HUPPass = @HUPPass,HUPAddress=@HUPAddress WHERE HUPName = @HUPName"

Code starts here
---------------------------------------------------------------------------------

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Main.aspx.vb" Inherits="Main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    Welcome to Admin Home
    </div>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        DataSourceID="SqlDataSource1" DataKeyNames="HUPName">
        <Columns>
            <asp:BoundField DataField="HUPName" HeaderText="HUPName"
                SortExpression="HUPName" />
            <asp:BoundField DataField="HUPPass" HeaderText="HUPPass"
                SortExpression="HUPPass" />
            <asp:CommandField ShowDeleteButton="True" />
            <asp:CommandField ShowEditButton="True" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        UpdateCommand="UPDATE HUPTable SET HUPPass = @HUPPass WHERE HUPName = @HUPName"
        SelectCommand="SELECT [HUPName],[HUPPass] FROM [HUPTable]"
        DeleteCommand="Delete from HUPTable where HUPName=@HUPName" >
        <DeleteParameters>
                <asp:Parameter Name="HUPName" Type="String" />
                 <asp:Parameter Name="HUPPass" Type="String" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="HUPName" Type="String" />
                 <asp:Parameter Name="HUPPass" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </form>
</body>
</html>

Friday, 18 November 2016

Change SelectCommand during Runtime in VB.NET

Hi All,

If you want to Change SelectCommand during Runtime in VB.NET use the code below in the page where the grid is placed.

Partial Class Main
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim qrystring As String
        qrystring = "U"
       
        SqlDataSource1.SelectCommand = "SELECT [HUPName],[HUPPass] FROM                   
        [HUPTable] where HUPName like '%" & qrystring & "%'"
     
        GridView1.DataBind()
    
    End Sub
End Class


Saturday, 5 November 2016

Process combo box

Hi all,
To retrive the content of a combo box use the code below in VB.NET




dim gender as string

gender=cboname.selectedItem.value