Hi everyone. Sorry if this question is in the wrong area..I posted it on the VB forum and they advised me to post here also.

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

Recommended Answers

All 5 Replies

Have a look at http://www.a1vbcode.com/snippet-3876.asp, it's not my code so i can't validate if it works, but best just to try it.
Nige

Well you have small problem there and that is -> chrisdent1986 used VisusalStudio wizard to get his connection string, where code provided by you is custom coding of a programmer that want to avoid drag&drop approach (which is my personal preference)
What you need to do is:

  1. in Data Sourcesclick on Edit DataSet with Designer
  2. right click(in lower part) on table you wish to use (as seen on attached screenshot)
  3. select Add >> Query and follow wizard
  4. Create new stored procedure >> Insert
  5. if you know SQL you can simply type your query or use Query Builder (view of QB on screenshot)
  6. Next >> and just follow wizard and make changes to names as neccesary

that should do the magic

try to execute the commands with EXECUTE IMMEDIATE .

Sorry - I thought this person wanted to create Oracle users, this isn't a case of adding a record to a table, it's more a case of executing various DDL statements to create the user, assign default tablespaces and grant permissions to allow them to do simple things like connect to a database.
Nige

To me it was random school assignment when they need to access DB and do something, will see what chrisdent1986 says when he eventualy find his way back to daniweb

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.