Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 10th, 2003, 10:18 PM
Authorized User
 
Join Date: Jun 2003
Location: rawalpindi, panjab, Pakistan.
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to arshad mahmood
Default How to search and display in textbox a specific ..

Hello Sir
I want to retreive a result by entring a key value in a
textbox and when i click button the reseult should beshown
on the bases of that key value which i have entered in the
text box.
For example:
I want to retreive the Author's name by entring the author_id
in a textbox.i want the author name should display in an
other textbox.
Is it posiable.
I hope u will help me.
Thanks

arshad mahmood
__________________
arshad mahmood
Reply With Quote
  #2 (permalink)  
Old July 11th, 2003, 08:07 AM
Authorized User
 
Join Date: Jun 2003
Location: , FL, USA.
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I use the recordset method so you can put something like this in your Click event....

Dim cxn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL As String

Set cxn = New ADODB.Connection
Set rst = New ADODB.Recordset

'I use an Access DB if you use something else - like SQL -
'your connection will be a bit different
With cxn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"add the absolute path to your data here"
.Open
End With

strSQL = _
"SELECT MyTable.strAuthorName" & _
"FROM MyTable " & _
"WHERE MyTable.intAuthorID= " & MyForm.TextBoxi & ";"

rst.Open strSQL, cxn, adOpenStatic, adLockReadOnly, adCmdText
    
txtResult.Text = rst!strAuthorName

rst.Close
Set rst = Nothing
cxn.Close
Set cxn = Nothing

Hope this helps you out.....

Kenny Alligood
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Move cursor to specific textbox mona_upm84 Excel VBA 3 September 22nd, 2016 10:29 AM
Move cursor to specific textbox mona_upm84 Excel VBA 0 September 29th, 2008 09:35 PM
Search specific data from specific columns yogeshyl SQL Language 1 January 16th, 2008 11:12 AM
How do after i login it will display specific user PHP FAQs 0 July 20th, 2006 08:06 PM
How do you open a specific record from a search? Szimmer9 VB How-To 1 March 31st, 2006 12:57 AM



All times are GMT -4. The time now is 05:10 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.