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

  Рет қаралды 34,460

1BestCsharp blog

1BestCsharp blog

Күн бұрын

Пікірлер: 23
@Trendinghut2021
@Trendinghut2021 2 жыл бұрын
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!
@davidbalamou3567
@davidbalamou3567 7 жыл бұрын
Oui c'est vraiment pratique merci beaucoup pour le code
@istimuthmainnah5210
@istimuthmainnah5210 5 жыл бұрын
Thank you so much
@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?
@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
@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 жыл бұрын
Thank YOu
@firstlivetv8158
@firstlivetv8158 6 жыл бұрын
good
@yuktiadhikary8615
@yuktiadhikary8615 6 жыл бұрын
there is no row at position 0 indexoutofrenge exception was unhandled this error show after debug
@jodikurniadi1186
@jodikurniadi1186 7 жыл бұрын
thanks sir...
@samcode4589
@samcode4589 7 жыл бұрын
how to retrive radio button from db
@gangaiahyelda65
@gangaiahyelda65 7 жыл бұрын
hello sir how to get audio
@yuktiadhikary8615
@yuktiadhikary8615 6 жыл бұрын
please help sir....
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 120 МЛН
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 37 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 66 МЛН
VB.Net - Insert Image Into SQL DataBase Part 2 [ with source code ]
7:54
Hoodie gets wicked makeover! 😲
00:47
Justin Flom
Рет қаралды 120 МЛН