Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 5th, 2007, 03:17 PM
Registered User
 
Join Date: May 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help With Searching Database (VB6.net)

Hi All



OK, so I am a newbie to vb.net .... I am using Visual Basic 2005 Express having previously only ever used Visual Basic 6....



Now, what I am doing is developing an app that will allow searching of my Access Database. For this (under vb6) I used the old DataControl to flick thru the d/base and used the following code to search my address book for any particular person (using my field titled Surname):



' Search database button and functionality
Private Sub SearchButton_Click()
Dim Content As String

Content = Trim(txt_findTitle.Text) & "*"

' Searching the "LAST" Field in the database (last name)
Content = "Surname like '" & Content & "'"

If txt_findTitle <> "" Then
databar.Recordset.FindFirst Content

If databar.Recordset.NoMatch = True Then
    MsgBox "No match found"
End If

End If
End Sub



This worked perfectly, showed the results in my form to the bound controls....



Now, all I want to do is replicate this in my new .net version of my app!!!

I have hunted the web and cannot find a means to do this so any help would be much MUCH appreciated as Im losing hair at a rate of knots!!

For info, within my .net app - I am using the BindingNavigator and done it all via the wizard as it was so much easier (and of course, gave me the buuilt in controls for >> << and add delete etc....if poss, I wanna keep using this but as I say, very confused on how best to do this.



All I really want to add is a textbox to accept a string (for the Surname search) and a command button to kick the search off with the FULL record for that surname returned or a "no item found" msgbox , as I had under vb6!!

Help, would be MUCHOS appreciated!

Cheers


Col







Similar Threads
Thread Thread Starter Forum Replies Last Post
searching a database mark jonas MySQL 13 January 19th, 2007 10:01 AM
Searching through a database d5t ASP.NET 1.0 and 1.1 Basics 6 October 27th, 2006 07:10 AM
help with Database searching europhreak Classic ASP Basics 1 February 8th, 2006 07:30 AM
Searching the database...HELP! Zedman BOOK: Beginning ASP 3.0 6 September 30th, 2004 09:52 AM
searching a database shabazzk Classic ASP Databases 2 March 10th, 2004 06:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.