Hi,

Label6.Caption = rcsetFran.Fields("franchiseid")

generates an error"Method item of object Fields failed".

If i do

Label6.Caption = rcsetFran(0)

then doesn't accept '0', i need to give '1'. In this case i can't return first column in the table. 1 returns second column.

How can i solve this problem.

Thanks

Hi,

How you have opened the Recordset..?
and what is the Datatype of First Field in the Table..?

Regards
Veena

Dim conn As New ADODB.Connection
Dim rcset As New ADODB.Recordset
Dim sqlquery As String


    conn.ConnectionString = "Driver={Microsoft ODBC for Oracle};Server=video;Uid=iii;Pwd=innsw;"
    conn.Open

    sqlquery = "select * from movie"
    Set rcset = conn.Execute(sqlquery)

    Label6.Caption = rcsetFran.Fields("franchiseid")

I use oracle and first column is autonumber.

Hi,

In Oracle how have you mentioned the first column as "AutoNumber"...?
What is the "DataType" you have given for first column..
As per my knowledge, there is no direct AutoNumber Data type in Oracle
(upto Oracle9i..)

Regards
Veena

Hi,
Yes first column is Automated that's why i get errors. But, it shouldn't be problem in VB6. If it is we have no chance of using Automated columns then!
Thanks

I Repeat..

What is the "DataType" you have given for first column in Oracle....?
How you have made it AutoNumber....?

Hi,
It is a "number" datatype which is automatically updated by a trigger and sequence.
Thanks

Hi,

I guess, the table has got some data.. (assuming ID field is not left null...)

Open recordset like this :

RecSet.Open strSQL,Conn,adOpenDynamic, adLockOptimistic

Regards
Veena

Hi Veena,

Thanks for your replies.
What is the difference between codes below and in which cases which one is used?

Rs.Open strSQL, conn, adOpenDynamic, adLockOptimistic
Rs.Open strSQL, conn, adOpenStatic, adLockReadOnly
Set Rs= conn.Execute(strSQL)

I always use 3rd one. Which way is better for me to use in future?

Thanks

Hi,

First Line :Opens a Recordset with Read/Write options

Second Line :Opens a Recordset with only Read option (Cannot edit or addnew record)

Third Line : also opend the record.

But , You needto open the recordset as first or second option (Depending on the requirement). It is the standard way of opening ADO Recordsets..

Regards
Veena

Thanks for all information Veena.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.