Solved

URGENT ODBC ERROR

Posted on 1998-06-23
9
290 Views
Last Modified: 2012-06-27
I CREATE THE DNS FOR THE DATABASE,(AND I DIDN´T PUT THE DATABASE IN READ ONLY). BUT WHIT THIS CODE WHEN I ADD A NEW RECORD, I HAVE THE ERROR "THIS DATABASE IS READ ONLY":

Dim wrkODBC As Workspace
Dim dbODBC As Database
Dim rstODBC As Recordset
Set wrkODBC = CreateWorkspace("WorkspaceODBC", "admin"_
, "", dbUseODBC)

Set dbODBC = wrkODBC.OpenDatabase("Calificador",_ dbDriverNoPrompt, False,_ "ODBC;DATABASE=Calificador;UID=;PWD=;DSN=Calificador")

Set rstODBC = dbODBC.OpenRecordset("SELECT * FROM CalDor")

rstODBC.Addnew 'THE ERROR OCURE IN THIS LINE
0
Comment
Question by:mexico
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 1

Expert Comment

by:kesonline
ID: 1464114
The recordset you are opening is an SQL query. Since it is not real data, just a subset there of, you can't add to it. I think you should be able to do this, depending on your db's layout:

Set rstODBC = dbODBC.OpenRecordset("CalDor") 'CalDor is the table name

Hope this helps.
0
 
LVL 4

Expert Comment

by:yowkee
ID: 1464115
mexico,

  If you use OpenRecordSet with only passing a Select SQL statement, it will open a readonly recordset by default. Therefore, if you want to open a recordset for update, try this:

Set rstODBC = dbODBC.OpenRecordset("SELECT * FROM CalDor", _
                                   dbOpenDynaset)    

For more setting/parameter such as locking, look for the help of "OpenRecordset method" in your VB help.

I summit this as a comment, if it work, please reject current answer and let me lock the answer.

Regards.
0
 

Expert Comment

by:Ajoy
ID: 1464116
Set dbODBC = wrkODBC.OpenDatabase("Calificador",_ dbDriverNoPrompt, False,_ "ODBC;DATABASE=Calificador;UID=;PWD=;DSN=Calificador")

Here while opening the database you have not specified the ACCESS type i.e read only/write only etc. So by default it takes read only.This will work so give me the points.

0
 

Author Comment

by:mexico
ID: 1464117
I TRY THE ANSWER AND THE COMMENTS, AND I STILL HAVE THE SAME ERROR. ANY NEW IDEA...
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 4

Expert Comment

by:yowkee
ID: 1464118
mexico,

Try this:
Set rstODBC = dbODBC.OpenRecordset("SELECT * FROM CalDor", _
                                   dbOpenSnapshot,dbConsistent)
rstODBC.AddNew


Is your database Jet DB or remote server database?    
0
 
LVL 1

Expert Comment

by:kesonline
ID: 1464119
If you want, I can run through the code for you. What kind of DB are you using? If you can, send the DB and the code to ben@kescom.net, and I'll check it out for you.
0
 

Author Comment

by:mexico
ID: 1464120
WELL, I TRY THE YOWKEE COMMENT, AND IN THAT LINE I HAVE THE RUN TIME ERROR 3001.
AND THE TYPE OF DATABASE THAT I AM USING IS A NORMAL JET DB, WHIT THE TABLE OF CalDor, AND ONE FIELD. AND THE CODE THAT I USE IS THE CODE THAT IS AT TOP.
SOMEBODY HAVE OPEN BEFORE A DATABASE WHIT ODBC... OR HAVE A CODE THAT'S WORK WHIT ODBC  
0
 
LVL 1

Expert Comment

by:kesonline
ID: 1464121
Why don't you just open it as a regular Jet database, instead of an ODBC data source? Also, in your ODBC control panel, you may not have the data source correctly set up.
0
 
LVL 1

Accepted Solution

by:
shagnasty earned 120 total points
ID: 1464122
I've had no end of trouble adding to ODBC datasources.  I solved 'em all by building an SQL INSERT INTO statement and then executinging it against the DB.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now