thanks you teached me this lesson i appreciate that
@abdofarag90592 жыл бұрын
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!
@davidbalamou35677 жыл бұрын
Oui c'est vraiment pratique merci beaucoup pour le code
@istimuthmainnah52105 жыл бұрын
Thank you so much
@sergionsumbonsimba65176 жыл бұрын
Como criar o controlo da data de caducidade de um produto (alguns dias antes) através de uma mensagem no sql e visual basic?
@hemantsuyash5 жыл бұрын
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
@erickamminga35657 жыл бұрын
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
@erickamminga35657 жыл бұрын
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
@erickamminga35657 жыл бұрын
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
@erickamminga35657 жыл бұрын
then in the form load event and in the add, update, delete event create a new datatable DT = getDataTable(connString, selectString)
@erickamminga35657 жыл бұрын
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
@erickamminga35657 жыл бұрын
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
@jackjill42204 жыл бұрын
Thank YOu
@firstlivetv81586 жыл бұрын
good
@yuktiadhikary86156 жыл бұрын
there is no row at position 0 indexoutofrenge exception was unhandled this error show after debug