Home » Other » General » can i know how ??
can i know how ?? [message #103178] Wed, 26 February 2003 02:19 Go to next message
jayapradeep
Messages: 2
Registered: February 2003
Junior Member
i am a new to oracle i am doing a project with visual basic as frontend and oracle as backend
i dont know how to connect the vb to my database in oracle so pls help me
thax in advance
Re: can i know how ?? [message #103184 is a reply to message #103178] Thu, 27 February 2003 04:18 Go to previous messageGo to next message
Garouppa
Messages: 27
Registered: February 2003
Junior Member
Izi like tisi
you must :
1-add a data access level to your VB project: open Project/references, qnd check the Microsoft Activex data object 2.5 (or higher if applicable).
2- whenever you want to issue an sql command to your database , put the command into a variable lets say SQL, fill in 3 more variables (user,paswd and server) with the credentials to your database, then issue the following code :
'----------------------------------------------
' CopyRight Garouppa
' the preceding line is just for kidding
'----------------------------------------------
Dim cn As New ADODB.Connection
Dim Rec As ADODB.Recordset
cn.Open "Provider=MSDAORA.1;User ID=" & User & ";password=" & Passwd & ";Data Source=" & Server & ";Persist Security Info=False"

Set Rec = cn.Execute(SQL)

'here you can play with the result of rec
' rec.eof turns true if the record reaces the end of the results
' rec.movenext goes to next record

rec.close
cn.close

You can if you want put the cn as global variable, and open it once for the whole application, even though i just .. do not like the idea.
Re: can i know how ?? [message #103221 is a reply to message #103178] Fri, 07 March 2003 21:45 Go to previous message
chetana
Messages: 11
Registered: June 2001
Junior Member
hi,
first u create a user and give dba privilege to that user.this is in oracle.
and in VB write
Dim con as new ADODB.Connection
Dim rs as new ADODB.Recordset

private sub form_load()
call hideall
con.open "provider = oraoledb.oracle;userid=username;
password= ;datasource=databasename"

try it
if u get or dont get then pls mail me
Previous Topic: Physical & Logical Structure of
Next Topic: Oracle 8i Installation on Windows2000 Professional
Goto Forum:
  


Current Time: Sat Nov 23 08:29:10 CST 2024