Results 1 to 8 of 8

Thread: Oledb/ado

  1. #1
    Join Date
    Nov 2002
    Posts
    17

    Unanswered: Oledb/ado

    Folks,

    I’m doing something wrong on my connection, but I can’t find out where it happens. I’ve tried to connect my database with OLEDB/ADO. Could someone help me???

    I wrote the following:


    Function AbreBanco()

    On Error GoTo TrataErro

    Dim MinhaConexao As ADODB.Connection
    Dim MeuRecordset As ADODB.Recordset
    Set MinhaConexao = New ADODB.Connection
    Set MeuRecordset = New ADODB.Recordset


    MinhaConexao.ConnectionString = "Ardent.UniOLEDB;Persist Security Info=True;" _
    & "DBMSTYPE = UNIVERSE;NETWORK = TCP / IP;SERVICE = uvserver;" _
    & "HOST = d4290s001;Data Source=Teste-VB;” _
    & “User ID= e036380; Password= mykey”

    MinhaConexao.Open
    Set MeuRecordset.ActiveConnection = MinhaConexao
    'strSQL = "SELECT * FROM TCOFRES"
    'Set rdoRes = rdoCon.OpenResultset(strSQL)
    'MeuRecordset.Open strSQL
    MeuRecordset.Open "SELECT TCOFRES 1"
    Do While Not MyRs.EOF
    MsgBox MeuRecordset(0)
    MeuRecordset.MoveNext
    Loop
    MeuRecordset.Close
    Set MeuRecordset = Nothing
    MinhaConexao.Close
    Set MinhaConexao = Nothing



    Saida:
    Exit Function

    TrataErro:
    MsgBox "Service is not available. Try later!", vbInformation, "Teste"
    Resume Saida

    End Function

    Please, someone help me!!!


    Scipione

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Which statement does it fail on ? Do you receive an error ? Try using the ado data control first to establish a connection - to verify that you can connect. If this is successful then copy what is stored in the properties for the connection string and use it for you adodb.connection object.

  3. #3
    Join Date
    Nov 2002
    Posts
    17

    I get if

    I get the connection, Now I´d like to get some help to work with DataGrid. How I can get the data on dataGrid???

    I´m setting my datasource, but I´m doing something wrong!!!
    I'm using Universe 5.0 (IBM) x Visual Basic 6

    Thanks

    Scipione.
    Last edited by Scipione; 12-01-02 at 21:52.

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    Can you post your code ?

  5. #5
    Join Date
    Nov 2002
    Posts
    17

    code to get Data on DataGrid

    Here's my code to get data on DataGrid, but it return some error!!!


    Private sub GetDataOnDataGrid()


    Dim rsEncheGrade As New ADODB.Recordset

    Set rsEncheGrade = New ADODB.Recordset


    sSQL = "SELECT @ID, TIPOCOFRE, MARCACOFRE,ESPECIFICACAO, LOCALIZACAO, TEMPORIZADOR FROM TCOFRES "



    rsEncheGrade.Open sSQL, MinhaConexao, adOpenStatic, adLockOptimistic


    Set grdCofres.DataSource = rsEncheGrade

    end sub



    **** Opening the DataBase

    Function AbreBanco()

    On Error GoTo TrataErro

    Set MinhaConexao = New ADODB.Connection
    Set MeuRecordset = New ADODB.Recordset


    MinhaConexao.ConnectionString = "Ardent.UniOLEDB;Persist Security Info=True;" _
    & "DBMSTYPE = UNIVERSE;NETWORK = TCP / IP;SERVICE = uvserver;" _
    & "HOST = d4290s001;Data Source=Teste-vb"
    ' & "User ID= e036380; Password= SenhaUser"




    MinhaConexao.Open

    MinhaConexao.CursorLocation = adUseClient

    Saida:
    Exit Function

    TrataErro:
    MsgBox "O serviço está indisponível no momento. Tente mais tarde!", vbInformation, "Teste"
    'MsgBox Err.Description
    'MsgBox Err.Number
    Resume Saida

    End Function

  6. #6
    Join Date
    Feb 2002
    Posts
    2,232
    What is the error (please translate) and error number ? Where does the error occur in your code ?

  7. #7
    Join Date
    Nov 2002
    Posts
    17

    OLEDB/ADO

    Hi!!!

    Could I call up you??? I think I can be more clear, and by phone I´ll try to explain to you my troubles and I´ll tell you every errors. If yes, please, give me the number, if not, I´ll post tomorrow, because I´m at my home right now and I don´t have Universe here!!!

    See you

    Thanks again!

    Scipione.
    Last edited by Scipione; 12-04-02 at 06:17.

  8. #8
    Join Date
    Nov 2002
    Posts
    17

    OLEDB/ADO

    Hi, rnealejr

    I hope you're ok!!!

    When I declare my statement SQL like this:

    sSQL = "SELECT @ID, TIPOCOFRE, MARCACOFRE,ESPECIFICACAO, LOCALIZACAO, TEMPORIZADOR FROM TCOFRES"

    the error turned to me is:

    [VMARK][UVODBC][1401030]Error ID: 29 Severity: ERROR Facility: FPSRVERR - Line 1, column 8 (around "@"): Syntax error

    By the way, I created other field called COD where I get the same index from recordid (=0), its a field like a mirror, but nothing happens...

    Please, what I'm doing wrong???


    Scipione.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •