Help! Recordset is readonly 
Author Message
 Help! Recordset is readonly

Hi,

I connect to a ODBC database SQL Server 6.5 like this:

Set mydatabase = DBEngine.OpenDatabase("tspro", dbDriverNoPrompt, False,
"ODBC;DATABASE=tspro;UID=sa;PWD=sa;DSN=tspro")

When I do this:

  set rs=mydatabase.openrecordset("config")
  rs.addnew

I get a message that the object is readonly. I have never set it to
readonly. MyDB.updatable is true just rs.updatable is false.

I did create the table like this:

Private Sub CreateConfigTable()
Dim MyTableDef As TableDef
Dim myfield As Field
Dim myIndex As Index

  Set MyTableDef = mydatabase.CreateTableDef("config")

  Set myfield = MyTableDef.CreateField("topic", dbText, 255)
  MyTableDef.Fields.Append myfield
  Set myfield = MyTableDef.CreateField("key", dbText, 255)
  MyTableDef.Fields.Append myfield
  Set myfield = MyTableDef.CreateField("content_string", dbText, 255)
  MyTableDef.Fields.Append myfield
  Set myfield = MyTableDef.CreateField("content_long", dbLong)
  MyTableDef.Fields.Append myfield
  Set myfield = MyTableDef.CreateField("content_single", dbSingle)
  MyTableDef.Fields.Append myfield
  Set myfield = MyTableDef.CreateField("content_boolean", dbBoolean)
  MyTableDef.Fields.Append myfield
  Set myfield = MyTableDef.CreateField("content_date", dbDate)
  MyTableDef.Fields.Append myfield
  Set myfield = MyTableDef.CreateField("content_memo", dbMemo)
  MyTableDef.Fields.Append myfield

  Set myIndex = MyTableDef.CreateIndex("idxcfg")
  Set myfield = myIndex.CreateField("topic")
  myIndex.Fields.Append myfield
  Set myfield = myIndex.CreateField("key")
  myIndex.Fields.Append myfield
  myIndex.Primary = False '!!!
  myIndex.Required = False
  ' Save Index definition by appending it to Indexes collection.
  MyTableDef.Indexes.Append myIndex
  mydatabase.TableDefs.Append MyTableDef

End Sub

Help!

--

bye, Boris Ottlewski - SystemSoft

*** Please do not reply via EMAIL ***



Sun, 07 Nov 1999 03:00:00 GMT  
 Help! Recordset is readonly

instead of using this statement
set rs=mydatabase.openrecordset("config")

use
set rs=mydatabase.openrecordset("config",dbopendynaset)

i hope it will work.

hitesh



Quote:

> Hi,

> I connect to a ODBC database SQL Server 6.5 like this:

> Set mydatabase = DBEngine.OpenDatabase("tspro", dbDriverNoPrompt, False,
> "ODBC;DATABASE=tspro;UID=sa;PWD=sa;DSN=tspro")

> When I do this:

>   set rs=mydatabase.openrecordset("config")
>   rs.addnew

> I get a message that the object is readonly. I have never set it to
> readonly. MyDB.updatable is true just rs.updatable is false.

> I did create the table like this:

> Private Sub CreateConfigTable()
> Dim MyTableDef As TableDef
> Dim myfield As Field
> Dim myIndex As Index

>   Set MyTableDef = mydatabase.CreateTableDef("config")

>   Set myfield = MyTableDef.CreateField("topic", dbText, 255)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("key", dbText, 255)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_string", dbText, 255)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_long", dbLong)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_single", dbSingle)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_boolean", dbBoolean)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_date", dbDate)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_memo", dbMemo)
>   MyTableDef.Fields.Append myfield

>   Set myIndex = MyTableDef.CreateIndex("idxcfg")
>   Set myfield = myIndex.CreateField("topic")
>   myIndex.Fields.Append myfield
>   Set myfield = myIndex.CreateField("key")
>   myIndex.Fields.Append myfield
>   myIndex.Primary = False '!!!
>   myIndex.Required = False
>   ' Save Index definition by appending it to Indexes collection.
>   MyTableDef.Indexes.Append myIndex
>   mydatabase.TableDefs.Append MyTableDef

> End Sub

> Help!

> --

> bye, Boris Ottlewski - SystemSoft

> *** Please do not reply via EMAIL ***



Sun, 07 Nov 1999 03:00:00 GMT  
 Help! Recordset is readonly



Quote:
> instead of using this statement
> set rs=mydatabase.openrecordset("config")
> use
> set rs=mydatabase.openrecordset("config",dbopendynaset)
> i hope it will work.

No! :(

--

bye, Boris Ottlewski - SystemSoft

*** Please remove nospam for a reply ***



Mon, 08 Nov 1999 03:00:00 GMT  
 Help! Recordset is readonly

Quote:

> Hi,

> I connect to a ODBC database SQL Server 6.5 like this:

> Set mydatabase = DBEngine.OpenDatabase("tspro", dbDriverNoPrompt, False,
> "ODBC;DATABASE=tspro;UID=sa;PWD=sa;DSN=tspro")

> When I do this:

>   set rs=mydatabase.openrecordset("config")
>   rs.addnew

> I get a message that the object is readonly. I have never set it to
> readonly. MyDB.updatable is true just rs.updatable is false.

> I did create the table like this:

> Private Sub CreateConfigTable()
> Dim MyTableDef As TableDef
> Dim myfield As Field
> Dim myIndex As Index

>   Set MyTableDef = mydatabase.CreateTableDef("config")

>   Set myfield = MyTableDef.CreateField("topic", dbText, 255)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("key", dbText, 255)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_string", dbText, 255)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_long", dbLong)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_single", dbSingle)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_boolean", dbBoolean)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_date", dbDate)
>   MyTableDef.Fields.Append myfield
>   Set myfield = MyTableDef.CreateField("content_memo", dbMemo)
>   MyTableDef.Fields.Append myfield

>   Set myIndex = MyTableDef.CreateIndex("idxcfg")
>   Set myfield = myIndex.CreateField("topic")
>   myIndex.Fields.Append myfield
>   Set myfield = myIndex.CreateField("key")
>   myIndex.Fields.Append myfield
>   myIndex.Primary = False '!!!
>   myIndex.Required = False
>   ' Save Index definition by appending it to Indexes collection.
>   MyTableDef.Indexes.Append myIndex
>   mydatabase.TableDefs.Append MyTableDef

> End Sub

> Help!

> --

> bye, Boris Ottlewski - SystemSoft

> *** Please do not reply via EMAIL ***

I am pretty sure your table does not have primary key.
Jet engine set a table readonly if the table is linked through ODBC and
the table does not have primary key.


Mon, 08 Nov 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help! - Readonly Recordset

2. Help! - Readonly Recordset

3. Help! - Readonly Recordset

4. Database readonly - only it's not readonly

5. Recordset readonly?

6. Why the Recordset is ReadOnly from SQL statment?

7. Recordset is readonly - why?

8. Recordsets always open readonly...argggg :)

9. ADO 2.5 Selecting Recordset Readonly.

10. ADO - (disconnected recordset) vs (Static and ReadOnly)

11. Recordset: What am I doing wrong?

12. Am I stupid or is it VB? [Recordsets]

 

 
Powered by phpBB® Forum Software