Sql = "select * from t_friend order by f_id desc"
Da_Friend.MissingSchemaAction = MissingSchemaAction.AddWithKey
Da_Friend.SelectCommand = New OleDbCommand(Sql, Con)
Try
Da_Friend.Fill(Ds_Friend, "auto_friend")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Dim DrMax As DataRow : Dim id_friend As String
If Ds_Friend.Tables("auto_friend").Rows.Count <= 0 Then
id_friend = "00001"
Else
DrMax = Ds_Friend.Tables("auto_friend").Rows(0)
Dim W, Po As String : Dim Num As Integer
W = DrMax("f_id").ToString()
Po = Mid(W, 2, Len(W))
Num = CInt(Po) + 1
id_friend = String.Format("{1:00000}", "", Num)
End If
TxtId.Text = "F" & id_friend