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
How to update Datefield
Apr 24 2014 2:47 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.ScreenGroupItems
Dim newMax As Integer = 0
objMax.GetRows(, "max(IOrder) + 1 as iOrder", , , , , )
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)
If .IsNewRecord Then
.SetVal("IOrder", newMax)
End If
'IChangeDateValue = .UpdateRow().ToString()
newkey = .UpdateRow()
IInpUserKey = .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("AIGRKey", SelMenuGroeplist.SelectedValue)
objScreenGroup.SetVal("IInpUserKey", IInpUserKey)
objScreenGroup.UpdateRow()
End Sub
[/code]
There are 2 datefields in the database:
-IInpChangeDate - this is the field when the record is created. So will not changed when record is updated
- IChangeDate - this is the record when the record is updated. Will change when the record is updated.
Thank you
Reply
Answers (
1
)
How to insert more than one id to a row in sql using c# code
http:// for www