Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
swapna.raj
Starting Member
1 Post |
Posted - 2013-01-14 : 14:10:00
|
Hi,I am trying to add a recod to a SQL Server 2008 table using DAO.AddNew. But this is giving me Database readonly err at runtime. Is there a way to overcome this problem?Below is my code sample.--------------------Option ExplicitDim grsIndexTable As RecordsetDim grsDocTable As RecordsetPublic DBConnection As DatabasePublic oWorkSpace As WorkspacePublic oDbEngine As New PrivDBEnginePublic ErrorLineNum As IntegerPrivate Sub Form_Load() On Error GoTo Error_Handler530 Set oWorkSpace = oDbEngine.CreateWorkspace("Test", "Admin", "")540 Set DBConnection = oWorkSpace.OpenDatabase("", False, False, "ODBC;DSN=Sales;UID=user;PWD=")1020 Set grsDocTable = DBConnection.OpenRecordset("DocTab1") MsgBox (grsDocTable.Updatable)1234 grsDocTable.AddNew1120 grsDocTable.Fields("DocID") = 31130 grsDocTable.Fields("Path") = "My Path"1140 grsDocTable.Update Exit Sub'---------------' Error Handler'---------------Error_Handler: If (ErrorLineNum = 0) Then ErrorLineNum = Erl End If MsgBox (ErrorLineNum & Err.Description)End Sub-------------------------Thanks for any help,Swapna |
|
Mar
Starting Member
47 Posts |
Posted - 2013-01-15 : 09:09:01
|
If you need help with an error it would help if you posted the error. |
|
|
|
|
|