VB.Net and Oracle SQL

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

toonworld

Thread Starter
Joined
May 19, 2004
Messages
26
I know VB.net and sql can be used together and I was wondering what exactly is involved in doing this. This post is probably vague but I want to do a program in visual basic. net using a sql database already created. Can someone tell me if its a hard process to use them together? And for vb.net what controls and other things that I will have to use with the sql database and displaying the sql database? If anyone can offer any comments its very appreciated. Thank you.
 

Ciberblade

Retired Moderator
Joined
Sep 22, 2003
Messages
16,279
Yes, this can be done. If you know SQL then the format is all you will need to get used to.

To get started you must connect to the database, and utilize a DataAdapter and DataSet. I have worked with this through Access via SQL and the three used are shown in red. You might need to use the two in green for your's. You will need the DataSet regardless.

The first thing you will need to do is connect to your database. In the properties for data...select "new connection" from the dropdown list...and then browse to your database,,,don't forget to test your connection or it will crash.

Second, configure your DataAdapter. When you click on it, the bottom of your properties box will contain a link that says "Configure Data Adapter..." Click on that.

Finally, the DataSet. This is what you will load the results of your query's into and pull from.

Now lets take a look at some of the code you will need to use. (keep in mind that this is only for syntax -- real names and values will be yours)
code said:
OleDbConnection1.Open()
sql = "select students.studentID, students.name, students.password "
TestDataAdapter.SelectCommand.CommandText = sql
DataSet.Clear()
TestDataAdapter.Fill(DataSet, "students")
avtests = DataSet.Tables("tests")

Catch exception As System.Data.OleDb.OleDbException
MessageBox.Show("Invalid Query")
TestDataAdapter.UpdateCommand.CommandText = squpd
TestDataAdapter.UpdateCommand.ExecuteNonQuery()
Now avtests is global and declared as type "DataTable" So you can get to it from other locations.

You may notice that I used the error correction of type exception...I use this so if there is an error, regardless of what it is, I can exit w/o the crash (saves time in debug)

There is much to this type of setup, and I know I just scratched the surface for you. I do not know if this is enough for completion, but it should get you in that direction. Good luck (y)
[tsg=welcome]Toonworld! To the best tech-support site on the net![/tsg]
 

Attachments

toonworld

Thread Starter
Joined
May 19, 2004
Messages
26
Thanks a lot. I do remember using data adapters and dataset once before. Unfortunately I don't think I know enough about visual basic.net to use sql with it and would be think it would take to longer to complete the project. I'm a novice still in this field and although it would be a good experience to use them together. Its a very difficult decision. I'll probably end up just using Oracle forms builder as i know it fairly well and am more comfortable with it. But like i said using vb.net with sql might be more beneficial to me in the long run like getting my first job.....
 

Ciberblade

Retired Moderator
Joined
Sep 22, 2003
Messages
16,279
Well then, you might want to consider using what you know to complete the project...then work on the .NET side later to better understand it.

Good Luck (y)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top