Paglia_V Inserito: 2 marzo 2007 Segnala Inserito: 2 marzo 2007 Ho realizzato un applicativo per recuperare dei dati da un database Access. Il mio attuale problema è come scrivere i valori letti da Access dentro a delle tag di un applicativo Stand Alone di RSView Studio 4.0All'interno del VBA di RSView studio si riesce a leggere e scrivere le tag creando un ogetto TagGroup e aggiungendo le tag che interessano per poi usarle tramite codice: ho provato lo stesso con il mio applicativo VB6 ma non sono riuscito, forse sbaglio nello scrivere il codice forse la strada da seguire è un'altra.Dal momento che si tratta di poche righe di codice da scrivere, ma nel modo corretto, c'è qualcuno che mi può dare una mano???Virginio
Paglia_V Inserita: 2 marzo 2007 Autore Segnala Inserita: 2 marzo 2007 Sono riuscito a trovare la soluzione, se qualcuno fosse interessato all'argomento occorre scrivere il seguente codice valido per una tag di prova:Sub SetUpTagGroup()Dim oCl As Application On Error Resume Next Err.Clear If oCl Is Nothing Then Set oCl = displayclient.Application End If If oGroup Is Nothing Then Set oGroup = oCl.CreateTagGroup("/", 500) If Err.Number Then LogDiagnosticsMessage "Error creating TagGroup. Error: " & Err.Description, ftDiagSeverityError Exit Sub End If oGroup.Add "TEST_TAG" oGroup.Active = True End IfEnd SubSub SetTagValue() On Error Resume Next Dim oTag As Tag If Not oGroup Is Nothing Then Set oTag = oGroup.Item("TEST_TAG") Err.Clear oTag.Value = 10 ' Test the Error number for the result. Select Case Err.Number Case 0: ' Write completed successfully... log a message LogDiagnosticsMessage "Write to tag " & oTag.Name & " was successful." Case tagErrorReadOnlyAccess: MsgBox "Unable to write tag value. Client is read-only." Case tagErrorWriteValue: If oTag.LastErrorNumber = tagErrorInvalidSecurity Then MsgBox "Unable to write tag value. The current user does not have security rights." Else MsgBox "Error writing tag value. Error: " & oTag.LastErrorString End If Case tagErrorOperationFailed: MsgBox "Failed to write to tag. Error: " & Err.Description End Select End IfEnd Sub
GALMA Inserita: 20 marzo 2007 Segnala Inserita: 20 marzo 2007 è molto più semplice....Basta che tra i Reference hai selezionato RSModel, ora in VBA crei oggettiQuesto è un esempio che avevo fatto come prova tempo fa, per importare delle cose da MySQL e passarle ad un TAG....c'è molto da tagliare come vedrai...Sub main()Dim AllTags As TagsDim SingleTag As TagSet AllTags = gTagDb.QueryForTags("AccessFiles\folder\*")Dim Risultato As ADODB.RecordsetDim conn As ADODB.ConnectionDim comSQL As ADODB.CommandDim querySQL As StringDim mess As StringDim nrow As IntegerSet conn = New ADODB.Connection conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=127.0.0.1;DATABASE=Bolton;UID=root;PWD=261281;"conn.OpenSet Risultato = New ADODB.RecordsetRisultato.Open "SELECT * FROM mp;", connDo While Not Risultato.EOF mess = Risultato!Nome Set SingleTag = gTagDb.GetTag("pippo\nuovastringa") SingleTag.Value = mess MsgBox mess Risultato.MoveNextLoopRisultato.Closeconn.CloseSet Risultato = NothingSet conn = NothingEnd Sub
Messaggi consigliati
Crea un account o accedi per commentare
Devi essere un utente per poter lasciare un commento
Crea un account
Registrati per un nuovo account nella nostra comunità. è facile!
Registra un nuovo accountAccedi
Hai già un account? Accedi qui.
Accedi ora