leeds2000
asked on
How to make this into a function, and then run it in a button
Im noob on functions, and need some help
I need my code to be made into a function, and then i need the ability to call this function inside any buttons i have
the part of the code that will be changed for every button is the "setning" variable
I need my code to be made into a function, and then i need the ability to call this function inside any buttons i have
the part of the code that will be changed for every button is the "setning" variable
Dim forbindelse As New System.Data.OracleClient.OracleConnection
forbindelse.ConnectionString = "user id=****;password=****;data source=oracle.*******"
forbindelse.Open()
Dim setning As String = "SELECT querys - changing on every button"
Dim kommando As New System.Data.OracleClient.OracleCommand(setning, forbindelse)
Dim dataleser As OracleClient.OracleDataReader
dataleser = kommando.ExecuteReader()
Me.Dgvstatistikk.DataSource = dataleser ''bind the results of the query to the listbox, make sure you have the display and value members of the listbox set to the correct column names in the query
dataleser.Close()
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oki, 2 great suggestions here :), i guess these will work in any way, so i will split the points
Becouse asvforce had a good sub suggestion, and jpaulino had a good function suggestion :)
Thanks guys
Becouse asvforce had a good sub suggestion, and jpaulino had a good function suggestion :)
Thanks guys
thanks leeds2000!
ASKER
will test is as soon as my database is up and running again :)