Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
Помогите! База на MS SQL Server 7, использую mdb(а не проект), подключение делаю "вручную" никаких связей эксесовских, встраиваний, присоединений и прочего использовать не хочу(в аксесе неделю). код: Public ADOConnection As ADODB.Connection Function OpenADOConnection() As Connection If ADOConnection Is Nothing Then Set ADOConnection = New ADODB.Connection ADOConnection.ConnectionString = "FILE NAME=путь к udl" ADOConnection.CursorLocation = adUseClient ADOConnection.Open End If Set OpenADOConnection = ADOConnection End Function Private Sub Form_Load() Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset rs.Open "select code, flight from way", OpenADOConnection, adOpenKeyset, adLockOptimistic Set Me.Recordset = rs field1.ControlSource = rs.Fields(0).Name End Sub После выполнения поле не позволяет редактировать. Как добиться возможности редактирования, а точнее обычной работы, как будто, если бы с помощью мастеров назначал источники данных? в хелпе ничего не нашел, uniquetable ставил, ключевое поле сделал(code). Не понимаю в чем собственно проблема. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 09:45 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
у меня все работает. Рекордсет обновляемый? права на запись есть? какая ошибка? Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 12:15 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
у тебя все работает, потому что у тебя Access 2002 и будет работать даже если ты Me.UniqueTable = "tst" уберешь. Человек же спрашивает по Access 2000 (смотри топик). ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 12:52 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
в Access2k работает такой код суть ADOConnection.Provider = "MSDataShape" Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 13:04 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
Knowledge Base ACC2000: Forms Based on ADO Recordsets Are Read-OnlyPSS ID Number: Q227053 Article Last Modified on 05-13-2002 -------------------------------------------------------------------------------- The information in this article applies to: Microsoft Access 2000 -------------------------------------------------------------------------------- Advanced: Requires expert coding, interoperability, and multiuser skills. This article applies only to a Microsoft Access database (.mdb). For a Microsoft Access 2002 version of this article, see Q281998 . Symptoms When you try to edit data in a form based on an ActiveX Data Objects (ADO) recordset, the form is read-only. This occurs even if you can successfully edit the recordset directly with ADO. Cause Microsoft Access forms will only allow you to edit data from an ADO recordset if the ADO recordset is created by using a combination of the MSDataShape and SQL Server OLEDB providers. Resolution Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: http://www.microsoft.com/partner/referral/ For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS The resolution depends on the source of data of the recordset that you want to bind to the form's Recordset property. Data Source Based on Microsoft SQL Server If the source of the data for the form is provided by Microsoft SQL Server 6.5 or later, you can use the MSDataShape and SQL Server OLEDB providers to create an ADO recordset that can be edited in a Microsoft Access form. NOTE: Microsoft Access forms will only allow you to edit one table from the recordset on which the form is based. If you set the form's Recordset property to an ADO recordset based on a view, stored procedure, or SQL statement that contains multiple tables, you must set the form's UniqueTable property to the name of the table that you want to edit in the form. Fields from other tables in the form's recordset will be visible on the form, but you will not be able to edit them. To use the MSDataShape and SQL Server OLEDB providers to create an ADO recordset and to assign the recordset to a form, follow these steps: CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database. Create an ODBC data source based on the Pubs sample database installed with Microsoft SQL Server. Open the sample database Northwind.mdb. Link the Authors table from the data source that you created in step 1. Create a new form based on the Authors table, and open it in Design view. Add all fields to the form's detail section. Clear the form's RecordSource property, so that the form is no longer directly bound to the Authors table. On the View menu, click Code. On the Tools menu, click References. Add a reference to the Microsoft ActiveX Data Objects 2.1 Library if it is not already selected. Click OK to close the References dialog box. Add the following code to the form's module: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. Close the form, and save it as frmAuthors. Open the frmAuthors form in Form view. Note that the form is successfully populated with data from the ADO recordset. Try to edit any field on the form. Note that you can successfully edit the form. Data Source Based on Other Data Sources If the source of data for the form is provided by any other source, such as the Microsoft Jet database engine, you cannot create an ADO recordset that can be edited with a form, even if you can edit the recordset directly with ADO. The only solution in this case is to use Data Access Objects (DAO) to create the recordset, and then to assign the recordset to the form's Recordset property. DAO is highly optimized for the Microsoft Jet database engine, and can access a number of ISAM or ODBC data sources that are accessible by the Jet database engine. If you are using an ISAM or ODBC data source, link the table to a Microsoft Jet database (.MDB) and use DAO to open a recordset based on the linked table. As long as the recordset can be edited directly via DAO, a form based on the recordset can be edited as well. To create a DAO recordset that can be edited in a Microsoft Access form, follow these steps. CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database. Open the sample database Northwind.mdb. Open the Products form in Design view. Clear the form's RecordSource property, so that the form is no longer directly bound to the Products table. On the View menu, click Code. On the Tools menu, click References. Add a reference to the Microsoft DAO 3.6 Object Library if it is not already selected. Click OK to close the References dialog box. Add the following code to the form's module: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. Save and close the Products form. Open the Products form in Form view. Note that the form is successfully populated with data from the DAO recordset. Try to edit any field in the form. Note that you can successfully edit the form. Status Microsoft has confirmed this to be a problem in the Microsoft products that are listed at the beginning of this article. More Information Steps to Reproduce Behavior CAUTION: Following the steps in this example will modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and perform these steps on a copy of the database. Open the sample database Northwind.mdb. Open the Products form in Design view. Clear the form's RecordSource property, so that the form is no longer directly bound to the Products table. On the View menu, click Code. On the Tools menu, click References. Add a reference to the Microsoft ActiveX Data Objects 2.1 Library if it is not already selected. Click OK to close the References dialog box. Add the following code to the form's module: Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. Save and close the Products form. Open the Products form in Form view. Note that the form is successfully populated with data from the ADO recordset. Try to edit any field in the form. Note that you are unable to edit the form and that Microsoft Access displays the text "Form is read-only" in the status bar. References For more information about the form Recordset property, click Microsoft Access Help on the Help menu, type form recordset property in the Office Assistant or the Answer Wizard, and then click Search to view the topic. -------------------------------------------------------------------------------- Send feedback to Microsoft © 2002 Microsoft Corporation. All rights reserved. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 13:11 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
прошу прощенья, действительно не обратил внимание на то что ACC2000 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 13:22 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
Проверил примерчик, что -=Alexey=- привел, все замечательно работет под access 2000. А я то наворотил, чтобы это реализовать -)) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 14:58 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
Хотя, это пример у меня заработал только с реальными таблицами.. С временными он не хочет работать.. А с реальными так работать некрасиво... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 15:17 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
напиши код, который работает с временными таблицами и не работает. желательно полностью. будем разбираться :) ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 11.02.2003, 16:59 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
Блин, не работает! Все приведу, что могу. CREATE TABLE [dbo].[spr_aircrafts] ( [board] [int] NOT NULL , - тут первичный ключ [code] [smallint] NOT NULL ) ON [PRIMARY] GO Option Compare Database Option Explicit Private Sub Form_Load() Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Set cn = New ADODB.Connection With cn .Provider = "MSDataShape" .ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=PDSP;Data Source=KFM;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=KFM;Use Encryption for Data=False;Tag with column collation when possible=False" .CursorLocation = adUseClient .Open End With Set rs = New ADODB.Recordset With rs .Source = "SELECT * FROM spr_aircrafts" .ActiveConnection = cn .CursorType = adOpenKeyset .LockType = adLockOptimistic .Open End With Set Me.Recordset = rs Me.UniqueTable = "spr_aircrafts" rs.Fields(0).Value = rs.Fields(0).Value + 10 'Эта и следующая строка работают rs.Update 'т.е. изменяют данные на сервере field1.ControlSource = rs.Fields(0).Name End Sub Свойства объектов в конце процедуры RS: EditMode = adEditNone CursorType = adOpenStatic CursorLocation = adUseClientBatch BOF = False EOF = False Index = "" LockType = adLockOptimistic RecordCount = 55 State = 1 Status = 0 Sort = "" ActiveConnection: CursorLocation = adUseClientBatch IsolationLevel = adXactReadCommitted Provider = "SQLOLEDB.1" State = 1 Version = "2.7" ME: Allow(все) = True, кроме AllowUpdating = 4 DefaultEditing = 1 DefaultView = 0 ConnectControl = <Введенное выражение содержит недопустимую ссылку на свойство "ConnectControl"> DynaSet = <Application-defined or object-defined error> MaxRecords = 10000 NewRecord = 0 RecordSetType = 4 UniqueTable = "spr_aircrafts" В меню Tools-References подключены: Visual Basic For Applications Microsoft Access 9.0 Object Library Ole Automation Microsoft ActiveX Data Objects 2.7 Сервис паков никаких не стоит на офис 2000 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 12.02.2003, 03:53 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
вместо ConnectionString = "Provider=SQLOLEDB.1;... попробуй ConnectionString = "Data Provider=SQLOLEDB.1;... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 12.02.2003, 08:44 |
|
||
|
Accecc2000&ado
|
|||
|---|---|---|---|
|
#18+
Т.к. не понимаю Аксеса, то решил немного потестировать, вот результаты(стоял 97 и 2000 одновременно): убил все аксесы, поставил 2к2. Так вот, в проекте не работает редактирование, а мдб все работает, причем с какими угодно параметрами...:( может из за сервис паков? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 12.02.2003, 08:46 |
|
||
|
|

start [/forum/topic.php?fid=45&msg=32104937&tid=1682325]: |
0ms |
get settings: |
8ms |
get forum list: |
18ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
32ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
53ms |
get tp. blocked users: |
2ms |
| others: | 205ms |
| total: | 335ms |

| 0 / 0 |
