VB.NET And SQL Database - Records Navigation Using Visual Basic .Net [ with source code ]

Поділитися
Вставка
  • Опубліковано 30 жов 2024

КОМЕНТАРІ • 24

  • @Trendinghut2021
    @Trendinghut2021 2 роки тому +1

    thanks you teached me this lesson i appreciate that

  • @abdofarag9059
    @abdofarag9059 2 роки тому

    hello, I followed you and I learned of you
    I have a question: if I have a picture field, how to get the image with showData' sub?
    Thank you!

  • @GuardaOsservaValuta
    @GuardaOsservaValuta 2 роки тому

    Perfect works fine but could you filter records based on a date from a datetimepicker?

  • @davidbalamou3567
    @davidbalamou3567 7 років тому +1

    Oui c'est vraiment pratique merci beaucoup pour le code

  • @hemantsuyash
    @hemantsuyash 5 років тому

    Hi
    can we add column name instead of column number i.e.
    txtEmpId.Text = empTable.Rows(position)(0).ToString()
    instead
    txtEmpId.Text = empTable.Rows(position)(emp_id).ToString()
    Hemant

  • @sergionsumbonsimba6517
    @sergionsumbonsimba6517 6 років тому

    Como criar o controlo da data de caducidade de um produto (alguns dias antes) através de uma
    mensagem no sql e visual basic?

  • @istimuthmainnah5210
    @istimuthmainnah5210 5 років тому +1

    Thank you so much

  • @yuktiadhikary8615
    @yuktiadhikary8615 6 років тому

    there is no row at position 0
    indexoutofrenge exception was unhandled
    this error show after debug

  • @erickamminga3565
    @erickamminga3565 7 років тому

    This code gives Exception. if you keep clicking previous the index goes negative, and there is no row in the datatable at position -1. Keep clicking next then the index will increase above the maximum nr of rows in datatable. This won't give exceptions because the data adapter keep filling the datatable with extra rows, but still not an elegant solution

    • @erickamminga3565
      @erickamminga3565 7 років тому

      first created a function to return a datatable to solve the problem with the accumulating nr of rows in the datatable
      Public Function getDataTable(connToDBString As String, selectString As String)
      'create a connection object, connecting to database
      Dim conn As New SqlConnection(connToDBString)
      'create command object taking the sql select string and connection object as parameter
      Dim command As New SqlCommand(selectString, conn)
      'create a new data adapter passing the command object as parameter
      Dim adapter As New SqlDataAdapter(command)
      Dim table As New DataTable
      'data adapter fills up the data table with data from database accordeing to select query
      adapter.Fill(table)
      Return table
      End Function

    • @erickamminga3565
      @erickamminga3565 7 років тому

      create a databale in the class of the form with navigation buttons
      Private DT As DataTable
      i have created the update, add and delete buttons in the form class as well

    • @erickamminga3565
      @erickamminga3565 7 років тому

      then in the form load event and in the add, update, delete event
      create a new datatable
      DT = getDataTable(connString, selectString)

    • @erickamminga3565
      @erickamminga3565 7 років тому

      changed the showData method
      Public Sub showData(position As Integer, DT As DataTable)
      Try
      txtID.Text = DT.Rows(position)(0).ToString
      txtFirstName.Text = DT.Rows(position)(1).ToString
      txtLastName.Text = DT.Rows(position)(2).ToString
      txtHouseNr.Text = DT.Rows(position)(3).ToString
      txtStreet.Text = DT.Rows(position)(4).ToString
      Catch ex As Exception
      MsgBox(ex.Message)
      End Try
      End Sub

    • @erickamminga3565
      @erickamminga3565 7 років тому

      for the button showing first record and last record:
      Private Sub btnFirstRecord_Click(sender As Object, e As EventArgs) Handles btnFirstRecord.Click
      index = 0
      showData(index, DT)
      End Sub
      Private Sub btnLastRecord_Click(sender As Object, e As EventArgs) Handles btnLastRecord.Click
      index = DT.Rows.Count - 1
      showData(index, DT)
      End Sub

  • @jackjill4220
    @jackjill4220 4 роки тому +1

    Thank YOu

  • @firstlivetv8158
    @firstlivetv8158 6 років тому +1

    good

  • @jodikurniadi1186
    @jodikurniadi1186 7 років тому

    thanks sir...

  • @gangaiahyelda65
    @gangaiahyelda65 7 років тому

    hello sir how to get audio

  • @samcode4589
    @samcode4589 7 років тому

    how to retrive radio button from db

  • @yuktiadhikary8615
    @yuktiadhikary8615 6 років тому

    please help sir....