Hi i want to create a application in VB. And i have created all the forms, and in the meantime i want one form to connect to database(lets say form name, DB). I have created it and connected to Oracle. Now in that form (DB) i want to search the Oracle table for its ID(which have been manually created by me using SQL commands). And if the ID matches with the user entered input, then all other details of that ID(say name, address) should appear in that form! How to do this? Any idea, i'm very newbie in VB, so kindly help me! It will be good even if you put the code snippet :)
Please say me how to do this?
For an introduction on connecting to an Oracle DB from VB .NET you could take a look at this tutorial. The technique described in this article is a simple and fast technique for getting started, however for production applications I would strongly recommend a mapper such as Nhibernate. Once you have performed your SQL select statement against the Oracle DB you will need to copy the data that you have read into an object to pass up to the UI layer:
Dim dr As OracleDataReader = cmd.ExecuteReader() ' VB.NET Dim userObject As New User() Dim name As String = dr.Read() Dim address As String dr.Read() userObject.Name = name userObject.Address = address
Once you have read the required data into memory you could use data binding to display the required data. Read more about it in this article. All you should need to do is create a control on your VB.NET form, and set the datasource the your userObject that you have read in from the database.