|
-
Apr 19th, 2002, 07:54 AM
#1
Thread Starter
Lively Member
ADOConnection
I used to initialize my Database Connection as follow:
With Region_Data
.Mode = adModeReadWrite
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51 ; Data Source = D:\Mdaisy\Mdaisy.mdb"
.CommandType = adCmdTable
.RecordSource = “Regions”
.Refresh
End With
Where Region Data is an adodc
After Reviewing the Crystal Report 8.5 Complete Reference Book, I got the following Connection.
'Open the data connection
Set ADOConnection = New ADODB.Connection
ADOConnection.Open "Provider=MSDASQL;Persist Security Info=False;Data Source=Millenium Database;Mode=Read"
I think that this is a better way, for I don’t have to specify the database path, I just do it in the ODBC Engine.
Well, and as you know things went great with the report.
N.B: In my application, which was a trial one, I didn’t have but the report.
For me to enhance my search and knowledge, I wanted to add a form which get, and update data in a table.
I added the following codes:
' Open the data connection
Set ADOConnection = New ADODB.Connection
ADOConnection.Open "Provider=MSDASQL;Persist Security Info=False;Data Source=Millenium Database;Mode=Read"
N.B: I am not opening the connection twice, I am doing it once at the initialization of the application.
With Adodc1
.Mode = adModeReadWrite
.ConnectionString = ADOConnection
.CommandType = adCmdTable
.RecordSource = "Group1"
.Refresh
End With
Adodc1.Recordset.MoveFirst
Text1 = Adodc1.Recordset!Description
Things went great, I am reading the records, navigating in them, and every think is great.
I wanted to save changes, so I added the following:
Adodc1.Recordset!Description = Text1
Adodc1.Recordset.Update
Similar to what I used to do before.
Here I got the following Error:
[Microsoft][ODBC Microsoft Access Driver] must use an updateable Query.
So what do you think the problem is, and how must we solve it, I don’t know if I am right, but is this gone do any think with the problem:
ADOConnection.Open "Provider=MSDASQL;Persist Security Info=False;Data Source=Millenium Database;Mode=Read"
-
Apr 19th, 2002, 07:59 AM
#2
PowerPoster
Well
ADOConnection.Open "Provider=MSDASQL;Persist Security Info=False;Data Source=Millenium Database;Mode=Read"
Change your mode. You only opened fro "READ" access...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Apr 19th, 2002, 08:24 AM
#3
PowerPoster
Well
Mode Property
Indicates the available permissions for modifying data in a Connection.
Settings and Return Values
Sets or returns one of the following ConnectModeEnum values.
Constant Description
adModeUnknown Default. Indicates that the permissions have not yet been set or cannot be determined.
adModeRead Indicates read-only permissions.
adModeWrite Indicates write-only permissions.
adModeReadWrite Indicates read/write permissions.
adModeShareDenyRead Prevents others from opening connection with read permissions.
adModeShareDenyWrite Prevents others from opening connection with write permissions.
adModeShareExclusive Prevents others from opening connection.
adModeShareDenyNone Prevents others from opening connection with any permissions.
Remarks
Use the Mode property to set or return the access permissions in use by the provider on the current connection. You can set the Mode property only when the Connection object is closed.
Remote Data Service Usage When used on a client-side Connection object, the Mode property can only be set to adModeUnknown.
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
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
|