leeds2000
asked on
Writing a SQL query through VB.net to oracle
Hey, i need to connect to oracle when i press a button, and ask this SQL query:
SELECT oi.vare_nr, oi.ans_nr, COUNT(*)
FROM ordreinfo oi, vare v, ansatt a
WHERE v.vare_nr = oi.vare_nr
AND a.ans_nr = oi.ans_nr
GROUP BY oi.vare_nr, oi.ans_nr;
after this i need to get the information i receive from the SQL query to a listbox, how do i do this?
I was thinking something like this (its some variables there in norwegian, but you understand :))
I dont understand how i should implement this SQL query to my code, and i dont know if this is the correct way to go :)
SELECT oi.vare_nr, oi.ans_nr, COUNT(*)
FROM ordreinfo oi, vare v, ansatt a
WHERE v.vare_nr = oi.vare_nr
AND a.ans_nr = oi.ans_nr
GROUP BY oi.vare_nr, oi.ans_nr;
after this i need to get the information i receive from the SQL query to a listbox, how do i do this?
I was thinking something like this (its some variables there in norwegian, but you understand :))
I dont understand how i should implement this SQL query to my code, and i dont know if this is the correct way to go :)
Dim forbindelse As New System.Data.OracleClient.OracleConnection
forbindelse.ConnectionString = "user id=****;password=****;data source=oracle.*******"
forbindelse.Open()
Dim setning As String = "sql query?????"
Dim kommando As New System.Data.OracleClient.OracleCommand(setning, forbindelse)
Dim dataleser As OracleClient.OracleDataReader
dataleser = kommando.ExecuteReader()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Im struggling with getting the information from this SQL query to show in the listbox or a datagridview, how do i do this?
please help
please help
you need to make sure the datatextfield and datavaluefield are set to the appropriate field names from the query so it knows which fields to use for the text and value
ASKER