TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
albert albert
NA
524
0
max record + 1
Apr 23 2014 9:34 AM
Hi everybody,
I have this:
[code]
Sub FormToData(ByVal datObj As DataLayer.ScreenGroupItems)
Dim newkey As Integer = 0
Dim IRecordStatusValue As Integer = 0
Dim IInpUserKey As String = System.DBNull.Value.ToString()
Dim IJavaValue As String = ""
Dim IInpChangeDateValue As Date = Date.Now.ToShortDateString()
Dim IChangeDateValue As Date = Date.Now.ToShortDateString()
'Dim IOrder As Integer
If String.IsNullOrEmpty(IJavaValue.ToString().Trim) = True Then
IJavaValue = vbNull
End If
Dim objMax As New DataLayer.ScreenGroupAuthItems
Dim newMax As Integer = 0
objMax.GetRows(, , , , "SELECT max(IOrder) + 1 FROM ScreenGroupItems")
If objMax.Count > 0 Then
newMax = CInt("0" & objMax.GetVal("IOrder"))
End If
With datObj
.GetRow(wform.Keys)
.SetVal("IDescriptionNL", TxtDescription.Text.Trim)
.SetVal("IURL", TxtURL.Text.Trim())
.SetVal("IIcon", txtIcon.Text.Trim)
.SetVal("IToolTipNL", TxtTooltip.Text.Trim)
.SetVal("Height", txtHoogte.Text.Trim)
.SetVal("Width", txtBreedte.Text.Trim)
.SetVal("IRecordStatus", IRecordStatusValue)
.SetVal("IInpChangeDate", IInpChangeDateValue.ToShortDateString())
.SetVal("IChangeDate", IChangeDateValue.ToShortDateString())
.SetVal("IJava", IJavaValue)
.SetVal("IOrder", newMax)
newkey = .UpdateRow()
IInpUserKey = .UpdateRow()
'IChangeDateValue = .UpdateRow().ToString()
'IInpChangeDateValue = .UpdateRow().ToString()
'IJavaValue = .UpdateRow()
'IChangeUserKey = .UpdateRow()
'IRecordStatusValue = .UpdateRow()
End With
Dim objScreenGroup As New DataLayer.ScreenGroupAuthItems
'Insert new row
objScreenGroup.GetRows(, , "AITKey =" & newkey & "AND AIGRKey =" & wform.DetailKeys)
If objScreenGroup.Count = 0 Then
objScreenGroup.GetNewRow()
End If
objScreenGroup.SetVal("AITKey", newkey)
'objScreenGroup.SetVal("IRecordStatus", IRecordStatusValue)
objScreenGroup.SetVal("AIGRKey", SelMenuGroeplist.SelectedValue)
objScreenGroup.SetVal("IInpUserKey", IInpUserKey)
objScreenGroup.UpdateRow()
End Sub
[/code]
And it goes about this piece of code:
objMax.GetRows(, , , , "SELECT max(IOrder) + 1 FROM ScreenGroupItems")
If objMax.Count > 0 Then
newMax = CInt("0" & objMax.GetVal("IOrder"))
End If
I want to have Max Iorder + 1(if you insert new record). But in the Database I still see the value 0.
Thank you
Reply
Answers (
4
)
Find path of all software's starting with same Prefix name
Dynamic data type