 |
 |

02-12-2005, 06:03 PM
|
|
Newcomer
|
|
Join Date: Dec 2004
Posts: 6
|
|
Editing and Updating Fields
|
I have the following fields, controls and datagrid in a form (frmInfo):
txtIdentNo
txtRev
txtTitle
txtRemarks
InfoGrid (Datagrid)
cSave, cUpdate, CDelete, cExit (command Buttons)
txtIdentNo and txtRev are both PRIMARY Keys.
I have the following question:
When I click on the cUpdate, I am UNABLE to edit or update the txtIdentNo and txtRev even though I have key-in the new txtIdentNo and txtRev in the fields???
I understand that fields that belong to the Primary Keys cannot be edited/updated but is there any work-around that allow me to edit or duplicate the other fields that ties to the txtIdentno and txtRev.
Any suggestions is appreciated.
|
|

02-13-2005, 09:49 AM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
|
Can we see the code you are using for this?
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|

02-14-2005, 07:36 AM
|
|
Newcomer
|
|
Join Date: Dec 2004
Posts: 6
|
|
|
Private Sub InfoGrid_DoubleClick(ByVal sender As System.Object, ByVal ne As System.EventArgs) Handles InfoGrid.DoubleClick
Dim cConnect As CDatabaseConnection
cConnect = New CDatabaseConnection(objConfig.Server(), objConfig.UserID(), objConfig.Pwd(), objConfig.DBType())
cConnect.Connection.ChangeDatabase(objConfig.DB())
Dim objInfo As New cInfo()
If objInfo.GetInstance(cConnect.Connection, "Info", InfoGrid.Item(InfoGrid.CurrentCell.RowNumber, 0), InfoGrid.Item(InfoGrid.CurrentCell.RowNumber, 1)) Then
txtIdentNo.Text = objInfo.IdentNo
txtRev.Text = objInfo.Rev
txtTitle.Text = objInfo.Title
txtRemarks.Text = objInfo.Remarks
cUpdate.Enabled = True
cSave.Enabled = False
cDelete.Enabled = False
cExit.Enabled = False
End If
cConnect.Close()
cConnect = Nothing
End Sub
Private Sub cUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cUpdate.Click
Dim cConnect As CDatabaseConnection
Try
cConnect = New CDatabaseConnection(objConfig.Server(), objConfig.UserID(), objConfig.Pwd(), objConfig.DBType())
cConnect.Connection.ChangeDatabase(objConfig.DB())
Dim objInfo As New cInfo()
objInfo.IdentNo = "Info"
objInfo.Rev = txtRev.Text
objInfo.Title = txtTitle.Text
objInfo.Remarks = txtRemarks.Text
If objInfo.Update(cConnect.Connection, "Info", txtIdentNo.Text) Then
End If
Catch ex As Exception
MsgBox(ex.Message)
cConnect.Close()
cConnect = Nothing
End Try
If Not cConnect Is Nothing Then
cConnect.Close()
cConnect = Nothing
End If
End Sub
|
|

02-15-2005, 04:07 AM
|
|
Newcomer
|
|
Join Date: Dec 2004
Posts: 6
|
|
|
can anyone advise what is wrong with my code that prevent me from updating the txtIdentNo?? Thanks,
|
|

02-15-2005, 04:41 PM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
|
What is CDatabaseConnection? Where do you define the definition for this class?
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|