Click to See Complete Forum and Search --> : Connection through coding


urs
August 7th, 2001, 12:33 PM
how can i connect adodc and oracle database throught coding
plzz help me out

Robert Moy
August 7th, 2001, 01:09 PM
Hello
Here is some code that can do it:


private Sub Command2_Click() 'Allow SQL query
Adodc1.RecordSource = "Select " & Text3.Text & _
" from " & Text4.Text & _
" WHERE " & Text5.Text & "=" & Text6.Text
Adodc1.Refresh
End Sub





'This opens Oracle. The user has to input thier userid and password

private Sub Command3_Click()
Adodc1.ConnectionString = "Provider=MSDAORA. 1;Password=" & Text2.Text & ";User ID=" & Text1.Text & ";Persist Security Info=true"
Adodc1.CommandType = adCmdUnknown
End Sub




I hope this will help.

coolbiz
August 7th, 2001, 01:53 PM
This topic has been discussed fairly often in this forum. Please do a search, either on ADODC or DATABASE itself to get the information.

The simples way is to add "Microsoft ADO Data Control x.x" into your project (COMPONENTS). Then add the ADODC component into your form (by default it will be called ADODC1). Right click on it and the wizard will come up for you to build the CONNECTION STRING. You can also use a UDL file or attach via ODBC.

For ORACLE connection, you MUST HAVE the Oracle Client installed on the computer and the TNSNAMES.ORA containing the alias (SERVICE NAME) to the server. The wizard will request for the service name, username and password.

Hope this helps,
-Cool Bizs

ramesh_mssg
August 7th, 2001, 10:39 PM
Try This,

dim con as Adodb.connection
dim rs as Adodb.recordset

Private Sub Form_Load()
con.connectionstring=uid=YourUsername;pwd=Yourpassword;DSN=YourDsnName;
con.open
rs.open "select *from YourTableName",con,2,3
End Sub

end sub