can you give me some search engine code. i am using sql server .. thank in advanced

can you give me some search engine code.

No, You have to show some effort for that first.

commented: :) +15

okay sir.. can i have one more favor.. can you please tell me why my program is not working.. this is my sample login program .. the data set is not able to count the data... i wonder why ??

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim connection As New SqlClient.SqlConnection
        Dim command As New SqlClient.SqlCommand
        Dim adapter As New SqlClient.SqlDataAdapter
        Dim dataset As New DataSet

        connection.ConnectionString = ("Data Source=CUBED-DESKTOP05;Initial Catalog=Biometrics;Integrated Security=True")
        command.CommandText = " SELECT * FROM (admin) WHERE username= '" & TextBox1.Text & "' AND password= '" & TextBox2.Text & "';"
        connection.Open()

        command.Connection = connection


        adapter.SelectCommand = command
        adapter.Fill(dataset, "0")

        Dim count = dataset.Tables(0).Rows.Count

        If count > 0 Then
            MsgBox("Welcome to Cubed Technologies", MsgBoxStyle.OkOnly)
            Form2.Show()
            Me.Close()
        Else
            MsgBox("Incorrect Login please Check your Username and Password")
            TextBox1.Clear()
            TextBox2.Clear()
            Me.TextBox1.Focus()

        End If


    End Sub

try this

Dim IDNumber As String = Nothing
        Dim User As String = Nothing
        Dim Pass As String = Nothing
          If txtUser.Text = "" Then txtUser.Focus() : MessageBox.Show("Please Enter Username", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) : Exit Sub
        If txtPass.Text = "" Then txtPass.Focus() : MessageBox.Show("Please Enter Password", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information) : Exit Sub

        User = GetFieldValue("SELECT UserName FROM tblUser WHERE UserName = '" & txtUser.Text & "'", "UserName")
        Pass = GetFieldValue("SELECT Password FROM tblUser WHERE UserName = '" & txtUser.Text & "'", "Password")


        If User = txtUser.Text And Pass = txtPass.Text Then
            IDNumber = GetFieldValue("SELECT UserID FROM tblUser WHERE UserName= '" & txtUser.Text & "'", "UserID")

            UserInfo.IS_USER = IDNumber
            MessageBox.Show("Login Succesful!", "Welcome", MessageBoxButtons.OK, MessageBoxIcon.Information)
 Else
            If Not User = txtUser.Text Then
                MessageBox.Show("Username not registered", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Else
                MessageBox.Show("Invalid Password", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information)
            End If

ohh thank you so much aldeene :) it will help me a lot :)

ohh aldeene there are some errors. is the a vb.net program ??

aldeene's code is a bit random. Why is there code to extract the user name from the database where the userName = txtUser.Text? It will only return what you already have - the entered user name. User is ALWAYS going to equal txtUser.text

All that is really needed is, as you did previously, to select the count of rows in the database where userName = user.Text and password = password.Text. This should provide a count of 1. What error were you getting with that code?

i think that code is for vb6 not for vb.net.. that's why its not accept hte other function in vb.net ...

you could try this for your login because you have shown some code.

Dim connection As New SqlClient.SqlConnection
Dim command As New SqlClient.SqlCommand
Dim adapter As New SqlClient.SqlDataAdapter
Dim dataset As New DataSet
 
connection.ConnectionString = ("Data Source=CUBED-DESKTOP05;Initial Catalog=Biometrics;Integrated Security=True")
    objconnection.Open() 'open connection to server 

            'this is the SQL select statement query that is performed
            ' to read the username and password from server 
            Dim SelectStmt As String = "SELECT * FROM users WHERE UserName ='" + TextBox1.Text + "' and " + _
                                "Password ='" + TextBox2.Text + "'"

            Dim objcommand As SqlCommand = New SqlCommand(SelectStmt, objconnection)

            Dim reader As SqlDataReader = objcommand.ExecuteReader

            If reader.Read Then

                MainForm.Show	'display login form

                Me.Dispose()'close login form

            Else

                'integer variable to count the number of times
                'the user has tried loggin in
                Static count As Integer = 0

                'display promt 
                Dim prompt As DialogResult = _
                MessageBox.Show("Invalid Username or Password!", "Login Error", _
                MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning)

                Select Case prompt

                    Case Windows.Forms.DialogResult.Retry
                        'keep login displayed for another trial 
                        userNameTextBox.Text = ""
                        passwordTextBox.Text = ""

                        count += 1 'increment counter by one 
                        If count = 3 Then
                            MessageBox.Show("High value of failed login attempts" & vbCrLf & _
                                           "Application will be terminated" & _
                                        " for security reasons", "Error", MessageBoxButtons.OK, _
                                        MessageBoxIcon.Stop)
                            Application.Exit()
                        End If

                    Case Windows.Forms.DialogResult.Cancel
                        Application.Exit()  'terminate application

                End Select

            End If
        Catch ex As Exception
            MessageBox.Show("Error: Login Failed for User:" & " " & userNameTextBox.Text)
        End Try
    End Sub
commented: neat code +0

i think that code is for vb6 not for vb.net.. that's why its not accept hte other function in vb.net ...

That code is in .net only.

Looking the syntax itself you should be able to know what language it is in.

ohh aldeene there are some errors. is the a vb.net program ??

coz i used a module there, the GetFieldValue line.. hehe sorry I forgot to revised it.. :D

aldeene's code is a bit random. Why is there code to extract the user name from the database where the userName = txtUser.Text?

I did this because what if the user changes his username..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.