Link to home
Start Free TrialLog in
Avatar of maybewecan
maybewecan

asked on

How to Query a database to return results to the neccessary textboxes

Good Morning All--

I am new to ASP.net and I am trying to complete my application here for work. I need some help with my query page. What I want to do is this, I have a field where the user inputs there vendor number, hits the query button, I then want it to return the name, address, state, zip that we currently have for their vendor number in our database. These values will return to the appropriate textboxes which I want to be "Read Only". I know I need to code a function in, then I need to code the query button in. Can someone help me?

If you need some more information let me know, Oh yeah I am doing this in VB.

Thanks much!
Avatar of djhex
djhex

1. Download data access application blocks from microsoft.
2. Reference the dll.

then use the sqlhelper.executereader to get the strings

    Public Function traeridclubxdeporte(ByVal posicionequipo1 As Int32, ByVal iddeporte As Int32) As string()
        sqlconnsirde = connbasica.connsirde()
        Dim arParams(2) As SqlParameter
        arParams(0) = New SqlParameter("@posicion", posicionequipo1)
        arParams(1) = New SqlParameter("@iddeporte", iddeporte)
        Dim dr As SqlDataReader = SqlHelper.ExecuteReader(sqlconnsirde, CommandType.Text, "select idclubxdeporte from tblclubesxdeporte where iddeporte=@iddeporte and posicion=@posicion", arParams)
        dr.Read()

dim res as string = new string(1){}
        Dim idclubxdeporte As Int32 = dr.GetInt32(0)  ' 0 position based
        dr.Close()
        sqlconnsirde.Close()
        Return res
    End Function


then in yoiur sub or method
      Dim res  as string() = new string{}

res= traerdeportedeprogramaespecial(idgrupoprogramaespecial)

textbox1.text = res(0)


ASKER CERTIFIED SOLUTION
Avatar of kollu
kollu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is not fair He didnt gave you  nothing


He gave you a link to sarch for it I gave you code.  This is going to be posted on support.
Avatar of maybewecan

ASKER

Yes, you gave me code but he gave me a better option for me to understand. Stop Whinning!!!!