Solved

A easy function question

Posted on 2007-11-21
3
131 Views
Last Modified: 2010-04-23
Ok, i know, i never remember HOW to place a function inside a button or similiar

How do i "call" this function inside a button?


Public Function finnOrdrenr() As Integer
 
        Dim forbindelse As New System.Data.OracleClient.OracleConnection
 
        forbindelse.ConnectionString = "user id=****;password=***;data source=*****"
        forbindelse.Open()
 
        Dim kommando As New System.Data.OracleClient.OracleCommand("select ordrner from", forbindelse)
 
        Dim dataleser As OracleClient.OracleDataReader
        dataleser = kommando.ExecuteReader()
        Dim onr As Integer
        While dataleser.Read()
            onr = dataleser.GetInt32(0)
        End While
 
        dataleser.Close()
        forbindelse.Close()
 
        Return onr
    End Function

Open in new window

0
Comment
Question by:leeds2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20326568
double click the button  and inside the sub routine block write this
msgbox (finnOrdrenr())
or just write
finnOrdrenr()
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20326573
Uhm, will this return the number i get inside the variable "onr" then?
0
 
LVL 23

Accepted Solution

by:
Ashish Patel earned 250 total points
ID: 20326623
you will have to fetch that result in a variable for your further use. for example

Dim varonr as Integer = finnOrdrenr()
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question