If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Oledb/ado

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-28-02, 12:25
Scipione Scipione is offline
Registered User
 
Join Date: Nov 2002
Posts: 17
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
Reply With Quote
  #2 (permalink)  
Old 12-01-02, 18:12
rnealejr rnealejr is offline
Registered User
 
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.
Reply With Quote
  #3 (permalink)  
Old 12-01-02, 20:44
Scipione Scipione is offline
Registered User
 
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 20:52.
Reply With Quote
  #4 (permalink)  
Old 12-03-02, 11:31
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Can you post your code ?
Reply With Quote
  #5 (permalink)  
Old 12-03-02, 14:02
Scipione Scipione is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 12-03-02, 16:06
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
What is the error (please translate) and error number ? Where does the error occur in your code ?
Reply With Quote
  #7 (permalink)  
Old 12-03-02, 18:08
Scipione Scipione is offline
Registered User
 
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 05:17.
Reply With Quote
  #8 (permalink)  
Old 12-04-02, 05:26
Scipione Scipione is offline
Registered User
 
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On