473,324 Members | 2,268 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

ADO Recordset Opens as Read Only

I am trying to rewrite a VB6 App in VB.NET but, from what I understand, I
must use ADO/ADOX to create a database. I tried to copy over my o;ld VB6
code that creates the DB, Creates a table and then adds the 1st record (a
contol record). The code that attempts to set the values for that 1st record
has errors claiming it is Read Only? (see relevant code below)

Questions:

1. Why is that recordset ReadOnly?

2. Can I create the table in VB.NET - if so - How?
================== code ====================
myRS = New ADODB.Recordset()

myRS.CursorType = adOpenKeyset

myRS.Open("[" & TableName & "]", myConn, adOpenDynamic, adLockOptimistic)

'*** Create control record ***

With myRS

..AddNew()

..Fields("Unit") = "$$$$"
--
------------------------------------
Wayne Wengert
wa***@wengert.org
Jul 19 '05 #1
2 5859
On Sat, 26 Jul 2003 21:01:25 -0600, "Wayne Wengert" <wa***@wengert.org> wrote:

¤ I am trying to rewrite a VB6 App in VB.NET but, from what I understand, I
¤ must use ADO/ADOX to create a database. I tried to copy over my o;ld VB6
¤ code that creates the DB, Creates a table and then adds the 1st record (a
¤ contol record). The code that attempts to set the values for that 1st record
¤ has errors claiming it is Read Only? (see relevant code below)
¤
¤ Questions:
¤
¤ 1. Why is that recordset ReadOnly?
¤
¤ 2. Can I create the table in VB.NET - if so - How?
¤
¤
¤ ================== code ====================
¤ myRS = New ADODB.Recordset()
¤
¤ myRS.CursorType = adOpenKeyset
¤
¤ myRS.Open("[" & TableName & "]", myConn, adOpenDynamic, adLockOptimistic)
¤
¤ '*** Create control record ***
¤
¤ With myRS
¤
¤ .AddNew()
¤
¤ .Fields("Unit") = "$$$$"

I don't see where you establish your database connection. Is there some code missing here?
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Jul 19 '05 #2
Sorry - the connection "myConn" is established in the code that created the
database - that seems to work fine.

Wayne

"Paul Clement" <Us***********************@swspectrum.com> wrote in message
news:f6********************************@4ax.com...
On Sat, 26 Jul 2003 21:01:25 -0600, "Wayne Wengert" <wa***@wengert.org> wrote:
¤ I am trying to rewrite a VB6 App in VB.NET but, from what I understand, I ¤ must use ADO/ADOX to create a database. I tried to copy over my o;ld VB6
¤ code that creates the DB, Creates a table and then adds the 1st record (a ¤ contol record). The code that attempts to set the values for that 1st record ¤ has errors claiming it is Read Only? (see relevant code below)
¤
¤ Questions:
¤
¤ 1. Why is that recordset ReadOnly?
¤
¤ 2. Can I create the table in VB.NET - if so - How?
¤
¤
¤ ================== code ====================
¤ myRS = New ADODB.Recordset()
¤
¤ myRS.CursorType = adOpenKeyset
¤
¤ myRS.Open("[" & TableName & "]", myConn, adOpenDynamic, adLockOptimistic) ¤
¤ '*** Create control record ***
¤
¤ With myRS
¤
¤ .AddNew()
¤
¤ .Fields("Unit") = "$$$$"

I don't see where you establish your database connection. Is there some code missing here?

Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Silvio Lopes de Oliveira | last post by:
Hello, I have a C++ / MFC app which uses CDatabase and CRecordset to connect to a ODBC data source for a SQL Server 7 database. The application worked properly with a MySQL database, but after...
2
by: Kevin Shea | last post by:
I'm currently running into a problem with ie6 on a windows 2000 machine. I've developed a web application where the client, using JavaScript, opens up an ADODB.Recordset recordset and then reads...
1
by: Ant | last post by:
Hello, I'm developing a program that will include a window showing current & previous records using a scrollable recordset. I need to add records to the recordset & have new records immediately...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
12
by: (Pete Cresswell) | last post by:
Say I've got a RecordSet: ----------------------------------------------------------- Set myRS = CurrentDB.OpenRecordset(SomeSQL, dbOpenDynaset)...
1
by: Ray Holtz | last post by:
I have a database in Access 2003 (Access2000 file format). There are two tables that are being used: Employees and Items. It is linked by the Employee field so that one employee can have many...
3
by: Susan Bricker | last post by:
I might not have phrased the question correctly in the Subject of this post. Please read the entire explanation. I have a form with a command button (Add New Person). This button opens up...
4
by: Wayne Wengert | last post by:
I am trying to rewrite a VB6 App in VB.NET but, from what I understand, I must use ADO/ADOX to create a database. I tried to copy over my o;ld VB6 code that creates the DB, Creates a table and then...
0
ADezii
by: ADezii | last post by:
When you create an ADO Recordset, you should have some idea as to what functionality the Recordset does/does not provide. Some critical questions may, and should, be: Can I add New Records to the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.