|
-
Nov 17th, 1999, 03:24 AM
#1
Thread Starter
New Member
Hey All,
I am fairly new to the VB world. Am trying to do a simple insert statement using VB and got this error message .. Can't Update. Database or object is read-only. error number 3027.
Running on VB 5 and SQL Server 7. Works fine with Access though. Attached below is a sample code that I am using. Any help will be greatly appreciated. Thanks a million.
Dim myDB As Database
Dim testTable As Recordset
Set myDB = OpenDatabase(recbooks, False, False, "database=recbooks;uid=sa;pwd=;dsn=connectionString")
Set testTable = myDB.OpenRecordset("narratorInfo")
With testTable
.AddNew
!lastname = "duh1"
!firstname = "duh1"
.Update
End With
-
Nov 17th, 1999, 03:28 AM
#2
Member
Hi there!!
Have you checked and make sure the database is closed? Also try to right-click the database in Windows Explorer and see if the Read Only Attribute is checked. If it is uncheck it. Good Luck!!
Lloyd
-
Nov 17th, 1999, 03:32 AM
#3
Thread Starter
New Member
Yup done all that.
End With
myDB.close
Ran other languages to test the db and it managed to update or delete or insert into the same database. Its only VB that is giving the problem. Thanks for the fast response.
-
Nov 19th, 1999, 12:40 PM
#4
Member
This happens to me a lot also. The thing that I have found is that I am opening multiple tables by a join (or a non-updatable recordset) If you are joining two tables, make sure you don't include both key fields in your select statement - wherever you did this at.
If it is happening on a single table, you would have to be out of access or make sure it isn't read only.
L
-
Nov 19th, 1999, 12:44 PM
#5
Thread Starter
New Member
I managed to find the solution. VB gives you read only because the table that you are quering does not contain a primary key. Include a primary key in that table and everything will work just fine.
Cheers to all..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|