How would I go about changing a record in a oracle database, using Ado and a MSHFlexGrid.
Thank you!!!
Printable View
How would I go about changing a record in a oracle database, using Ado and a MSHFlexGrid.
Thank you!!!
Does the UPDATE DDL work in your case? BTW, is your Oracle running in Window OS?
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
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??? :confused:Quote:
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.
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.
can evaluate toCode:sqlsomething = "UPDATE tablename SET " & objrsflx.Fields(flex.Col).Name & " = '" & Replace(txtflex.Text, "'", "''") & "' WHERE " & "(SOME CONDITION HERE, SUCH AS PRIMARY KEY);"
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
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?!? :eek:Quote:
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.
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?
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.
Update didn't work for me.
Mendhak - I have no clue who rachwill is, or pajess, nor do I want to.