Oracle and Visual Basic 6.0 [message #269019] |
Thu, 20 September 2007 08:11 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
devendra_ora
Messages: 6 Registered: September 2007
|
Junior Member |
|
|
Hi,
1. I wanted to know that how one can give runtime connection string in visual basic so as to connect to oracle database 10g.
2. I also wanted to know how we can verify users credentials and give permissions to modify,insert and view the database only in visual basic as frontend.
kindly help me.
|
|
|
Re: Oracle and Visual Basic 6.0 [message #269035 is a reply to message #269019] |
Thu, 20 September 2007 09:04 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/102589.gif) |
Michel Cadot
Messages: 68675 Registered: March 2007 Location: Nanterre, France, http://...
|
Senior Member Account Moderator |
|
|
1.
Set OraSession = CreateObject("OracleInProcServer.XOraSession")
Set OraDatabase = OraSession.OpenDatabase(<service name>, <username/password>, ORADYN_DEFAULT)
Of course, you have to previously install an Oracle client.
2.
Use a logon trigger to check the program (easiest but not safe way).
Use secure application role (check for this in documentation)
Regards
Michel
[Updated on: Thu, 20 September 2007 09:06] Report message to a moderator
|
|
|
Re: Oracle and Visual Basic 6.0 [message #269143 is a reply to message #269035] |
Thu, 20 September 2007 16:31 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.orafaq.com/forum/images/custom_avatars/111249.jpg) |
Soumen Kamilya
Messages: 128 Registered: August 2007 Location: Kolkata
|
Senior Member |
![soumen.kamilya@gmail.com](/forum/theme/orafaq/images/google.png)
|
|
You can do it also using ODBC driver
con.Open "Provider=OraOLEDB.Oracle.1;User ID=" & User_Name & ";Password=" & Pass_word & ";Data Source=" & data_Source .
You can read the values User_Name,Pass_word,data_Source using INI file. Sample code is here:
Function Read_INI_File(dbName As String)
Dim fnum As Integer
Dim one_line As String
Dim pos As Integer
Dim iniValue As String
fnum = FreeFile
Open CurDir & "\" & "DBNAME.INI" For Input As fnum
Do While Not EOF(fnum)
' Read a line.
Line Input #fnum, one_line
'MsgBox one_line
' See what it is.
If Left$(one_line, 1) = "[" Then
' Section heading.
iniValue = Mid$(one_line, 2, Len(one_line) - 2)
If dbName = iniValue Then
Line Input #fnum, one_line
pos = InStr(one_line, "=")
data_Source = Mid$(one_line, pos + 1)
Line Input #fnum, one_line
pos = InStr(one_line, "=")
User_Name = Mid$(one_line, pos + 1)
Line Input #fnum, one_line
pos = InStr(one_line, "=")
Pass_word = Mid$(one_line, pos + 1)
'MsgBox databaseName & User_Name & Password
Exit Do
End If
End If
Loop
Close fnum
End Function
INI File should contains like that:
[HR]
DATABASE=XE
USER=HR
PASSWORD=HR
Cheers
Soumen
[Updated on: Thu, 20 September 2007 16:32] Report message to a moderator
|
|
|
|
|
|
|
Re: Oracle and Visual Basic 6.0 [message #271467 is a reply to message #269019] |
Mon, 01 October 2007 13:22 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
devendra_ora
Messages: 6 Registered: September 2007
|
Junior Member |
|
|
1. The datatype of the stored image is BLOB in oracle database.
I am using VB's dataenvronment to connect to the oracle database.
But it does not retreves the field of image which is of BLOB type rest all fields VB is able to retrieve from oracle database.
2. Secondly one peculiar thing i noticed while working with Visual basic and oracle database,that if u change something in textbox which is connected to one of the fields of table in oracle database.And if u simply move to next record usng browse button in Vb form, the change gets updated even if I have notused or clicked the update button which uses
"dataevironment1.rsemp.Update" method in VB.
How to prevent this.
|
|
|
|
Re: Oracle and Visual Basic 6.0 [message #271596 is a reply to message #271486] |
Tue, 02 October 2007 02:35 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
devendra_ora
Messages: 6 Registered: September 2007
|
Junior Member |
|
|
The code given below is of the VB form which uses to connect to patient table of SCOTT in Oracle 10g.The problem is that when user changes text in the textbox and moves to next record by "de1.rspatient.MoveNext" the changed data gets updated on its own.
how to resolve this problem.
Private Sub Command1_Click()
de1.rsdoctor.AddNew
End Sub
Private Sub Command2_Click()
Dim u As Integer
u = MsgBox("Do you want to Update the data !", 1, "Confirm Update !")
If u = 1 Then
de1.rsdoctor.Update
End If
End Sub
Private Sub Command3_Click()
Dim a As Integer
a = MsgBox("Do you want to delete this Record !", 1, "Confirm Delete !")
If a = 1 Then
de1.rsdoctor.Delete
End If
End Sub
Private Sub Command4_Click()
de1.rsdoctor.MoveFirst
End Sub
Private Sub Command5_Click()
de1.rsdoctor.MovePrevious
If de1.rsdoctor.BOF Then
MsgBox ("You are at the First Record !")
de1.rsdoctor.MoveNext
End If
End Sub
Private Sub Command6_Click()
de1.rsdoctor.MoveNext
If de1.rsdoctor.EOF Then
MsgBox ("You are at the Last Record !")
de1.rsdoctor.MovePrevious
End If
End Sub
Private Sub Command7_Click()
de1.rsdoctor.MoveLast
End Sub
|
|
|
|
Re: Oracle and Visual Basic 6.0 [message #272280 is a reply to message #271609] |
Thu, 04 October 2007 07:25 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
devendra_ora
Messages: 6 Registered: September 2007
|
Junior Member |
|
|
Thanks Michel !
I used Microsoft OLEDB for oracle ODBC driver for connecting with oracle.
I 'll check regarding the attribute parameters what u said and get back to u !
2. Secondly I had problem regarding views.I have created a view which connects one primary table and 7 other secondary table
which connect to the main table with primary key-foreign key relationship with the key ID(nunmber(10)).
Now the view so created reproduces cartesian product of all the 8 tables resulting into huge data.Although the tables contain only 4 records each.Can I get result from this view using where clause in which i give a partcular ID to find.
|
|
|
|