473,395 Members | 1,978 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,395 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 5863
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.