Now a days I am facing a problem while working with oracle and VB which is
irritating me a lot since last few days and after having a discussion with
many professionals I am now turning and looking to you for the solution. The
problem is as follows:
I had a table in oracle8i named TEST with details as:
Field datatype width
No varchar2 10
Name varchar2 50
Now I made a standard exe project in VB6.0 and the form contains one ADODC
control which is linked with the above table in oracle using Microsoft ODBC
for oracle driver and there were two text boxes and one datagrid component
on the form the text boxes are not bound with any datasource (which is
ADODC1 here) and the datagrid is bound with the datasource ADODC1, there
were two buttons on the form with name cmdaddnew and cmdsave and I write the
following code on them:
Private Sub cmdaddnew_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
Private Sub cmdsave_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0) = Text1.Text
Adodc1.Recordset.Fields(1) = Text2.Text
Adodc1. Recordset.Update
Adodc1.Refresh
End Sub
Now as I run the form and make two entries in the text boxes and save them
say for ex:.
(1). No=1
Name= "hitesh"
(2). No=2
Name="suresh"
Now I closes the application and then run again now what I see is , the
second record which is(2,suresh) comes to the first position in the database
and the first record(1,hitesh) comes to the second position in the database
(i.e. the order of records is reversed )
So please tell me why it is happening and what is the solution to get rid of
it.
Thanking you all for you valuable time and support to me.
Hitesh jain
To force the server to give the records in the order you want, use an ORDER
BY statement in your SQL.
SELECT * FROM TEST
ORDER BY No
Alternatively specify an Index on the table and use it if the recordset
supports index, or use the Sort method.
--
Michael Collier Bsc (Hons)
Interactive ADO Browser Trial www.adoanywhere.com/cnet
Free ADO Browser (FAB) www.adoanywhere.com/fab
Home Page www.adoanywhere.com
Email mi...@adoanywhere.com
--
"hitesh" <hitesh...@hotmail.com> wrote in message
news:u#3WhvHyBHA.872@tkmsftngp02...