Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2005-04-08
5
Medium Priority
?
198 Views
Last Modified: 2010-04-07
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!
0
Comment
Question by:maybewecan
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:djhex
ID: 13736084
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)


0
 
LVL 5

Accepted Solution

by:
kollu earned 1500 total points
ID: 13736134
See this example
http://www.asp101.com/samples/db_search.asp(look for asp.net version)
0
 
LVL 10

Expert Comment

by:djhex
ID: 13740108
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.
0
 

Author Comment

by:maybewecan
ID: 13740555
Yes, you gave me code but he gave me a better option for me to understand. Stop Whinning!!!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

581 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