|
-
Jan 16th, 2003, 12:58 AM
#1
Thread Starter
New Member
Changing a record in an Oracle database
How would I go about changing a record in a oracle database, using Ado and a MSHFlexGrid.
Thank you!!!
-
Jan 16th, 2003, 03:15 AM
#2
PowerPoster
Does the UPDATE DDL work in your case? BTW, is your Oracle running in Window OS?
-
Jan 16th, 2003, 08:45 AM
#3
How are you editing the boxes in the flexgrid? Are you editing directly, or are you using a 'transparent' textbox?
Either way, in their respective validation events, you can use this code:
VB Code:
Private Sub txtflex_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
'ENTER
sqlsomething = "UPDATE tablename SET " & objrsflx.Fields(flex.Col).Name & " = '" & Replace(txtflex.Text, "'", "''") & "' WHERE " & "(SOME CONDITION HERE, SUCH AS PRIMARY KEY);"
objconn.BeginTrans
objconn.Execute sqlsomething
objconn.CommitTrans
objrsflx.Update
call FunctionToFillFlexGridAgain()
txtflex.Visible = False
ElseIf KeyAscii = 27 Then
txtflex.Visible = False
End If
End Sub
Note: objrsflx is the recordset I used to fill in the flexgrid, and sqlsomething is the statement to be executed to update the oracle database, and I have used a textbox txtFlex to edit values.
modify as appropriate.
HTH
-
Jan 16th, 2003, 04:02 PM
#4
New Member
Is 13 the data in the recordset?
I tried the code, put in my tablename, nothing happened?
I will be changing the data using a command button.
I want to be able to change a string value, to a string value
sqlsomething = "UPDATE tablename SET " & objrsflx.Fields(flex.Col).Name & " = '" & Replace(txtflex.Text, "'", "''") & "' WHERE " & "(SOME CONDITION HERE, SUCH AS PRIMARY KEY);"
objrsflx.Fields(flex.Col).Name & " = '" // should I put something where the = is?
txtflex.Text, "'", "''") //or do I put the text in here?
Thanks.
-
Jan 17th, 2003, 07:37 AM
#5
Originally posted by RachWill
Is 13 the data in the recordset?
I tried the code, put in my tablename, nothing happened?
I will be changing the data using a command button.
I want to be able to change a string value, to a string value
sqlsomething = "UPDATE tablename SET " & objrsflx.Fields(flex.Col).Name & " = '" & Replace(txtflex.Text, "'", "''") & "' WHERE " & "(SOME CONDITION HERE, SUCH AS PRIMARY KEY);"
objrsflx.Fields(flex.Col).Name & " = '" // should I put something where the = is?
txtflex.Text, "'", "''") //or do I put the text in here?
Thanks.
Are you jessejames??? 
You put the text in txtflex, the transparent, borderless textbox.
keyascii= 13 is for when the user presses enter. if the user presses Enter (key 13), then the code to update the database will execute.
Code:
sqlsomething = "UPDATE tablename SET " & objrsflx.Fields(flex.Col).Name & " = '" & Replace(txtflex.Text, "'", "''") & "' WHERE " & "(SOME CONDITION HERE, SUCH AS PRIMARY KEY);"
can evaluate to
sqlsomething = "UPDATE tablename SET membername = 'geordie' WHERE memberid = 92;"
"membername" is the name of the column in which you are currently editing.
"geordie" is the value in the textbox.
"memberid" is the primary key of the table, "92" is the value for that current row you are editing.
HTH
-
Jan 17th, 2003, 01:57 PM
#6
Member
Won't work in oracle database
Mendhak,
Have you tried the update function on a oracle database?
I tried using your code in oracle and it will not work.
-
Jan 18th, 2003, 07:25 AM
#7
Re: Won't work in oracle database
Originally posted by Pajess
Mendhak,
Have you tried the update function on a oracle database?
I tried using your code in oracle and it will not work.
Do you have three screennames?!? 
Post the code that you tried. The code I posted is incomplete, it was to give you an idea.
What code did you use, and what error did you get?
-
Jan 18th, 2003, 01:59 PM
#8
Member
What are you going on about three screennames???? There are probably quite a few people wanting to know about oracle.
I just know to "talk" to a oracle database you need commands oracle understands, i'm not sure if oracle would understand update.
That is why I asked have you tested it on a oracle database to see if update does work.
-
Jan 18th, 2003, 02:03 PM
#9
Thread Starter
New Member
Update didn't work for me.
Mendhak - I have no clue who rachwill is, or pajess, nor do I want to.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|