Private Sub Maxid()
sb.Remove(0, sb.Length)
sb.Append("SELECT id_potion")
sb.Append(" FROM tbl_potion")
sb.Append(" ORDER BY id_potion DESC")
Dim sqlCustomer As String = sb.ToString()
Dim dr As OleDbDataReader
Dim dt As DataTable
com = New OleDbCommand()
With com
.CommandType = CommandType.Text
.CommandText = sqlCustomer
.Connection = Conn
dr = .ExecuteReader()
If dr.HasRows Then
dt = New DataTable()
dt.Load(dr)
ดึงรหัสล่าสุดมาแสดง
Else
dgvCustomerList.DataSource = Nothing
End If
End With
dr.Close()
End Sub
Private Sub Maxid()
sb.Remove(0, sb.Length)
sb.Append("SELECT id_potion")
sb.Append(" FROM tbl_potion")
sb.Append(" WHERE id_potion = IDENT_CURRENT('tbl_potion')")
sb.Append(" ORDER BY id_potion DESC")
Dim sqlCustomer As String = sb.ToString()
Dim dr As OleDbDataReader
Dim dt As DataTable
com = New OleDbCommand()
With com
.CommandType = CommandType.Text
.CommandText = sqlCustomer
.Connection = Conn
dr = .ExecuteReader()
If dr.HasRows Then
dt = New DataTable()
dt.Load(dr)