Hi. I have created a visual basic system that is connected to an oracle database.

(I connected through data>Add New Data source>New Connection>Oracle Database etc etc)

I am using the system to create new oracle users with passwords etc.

I have a form called frmAdd and text boxes txtUser and txtPassword

The user of the system will input into txtUser the username they wish to create (eg user1) and then their password (eg password)

they will then click the cmdAdd button.

I wish to send the following command to the oracle databse when they click the button

Create user (txtUser.text)
Default Tablespace users
identified by (txtPassword.text)


There are a lot of other commansd I need to do but I'm sure I can manage it myself after I get help with this one.

Could someone tell me how to go about this please. As it's for a university assignment that needs to be handed in next week.

Regards

Chris

I'm not doing this to bump my thread but the lack of replies is slightly ruining my morale. If I am going about this the wrong way could somebody please post some advice on how else to go about it cheers.

Hi cris,

Sorry, Dnt know abt data control much. But,

Can you execute sql statements using this control like connection.execute method in ADO.

If you can, why can't you try

data.execute "create user " & txtuser.text & " identified by " & txtpwd.text & " default ............. "


Regards

I'm sorry for my ignorance. I understand ADO is some sort of interface between web applications and databases but can I use that for VB also? and if so how do I go about creating the link? do I have to download additional software or anything?

regards

Chris

hello chrisdent1986,
its look like you are working in .NET.......isn't it?

if you are working in .NET platform then you have to implement the ADO.Net classes.......for better replies post your questions to The VB.NET Forum.

now if you wish to continue to work in vb6 then you can use ADO in order to communicate with your oracle server. there are two methods that you can use :- (1) using a data bound control like ORACLE DATA CONTROL or ADODC CONTROL and (2) using ADODB objects and methods. if you want my opinion i'll suggest you to go for the second technique. there you'll get a connection object and using Execute method of this connection object you can easily create any back-end operations from your application. like if you wish to create the user then the following is a sample snippet for you using vb6 syntax :-

just add the following reference from your VB6 IDE->Project->References :-
Microsoft Activex Data Objects <Version No.> Library

Dim gCn as New ADODB.Connection

Private sub Command1_Click()
Dim str as String
Dim username as String, table_space as string

gCn.ConnectionString=<your connection string>
you can create the connectionstring using various approach. the most easiest technique is to use an .UDL file.
gCn.Open
MsgBox "Connection Established."

username=Trim(txtUsername.text)
table_space="myServer_tableSpace"

gCn.Execute "CREATE USER '" & username & "' identified by '" & table_space & "'"
Msgbox "Default user created..."
End Sub

get me if this works for you.

regards
Shouvik

Yes you can. Add ADO data control from Projects > Components.

or

You can use ADO OLEDB

Go to Projects > References and add Microsoft ActiveX Data Objects Library

google for ADO AND OLEDB for tutorials.

HTH

This article has been dead for over six months. Start a new discussion instead.