Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 5th, 2007, 6:42 AM   #1
tau
Newbie
 
Join Date: Dec 2007
Posts: 1
Rep Power: 0 tau is on a distinguished road
Exclamation Searching A Record

Please Help I M Still New In Vb6 So I M Trying To Create A Databse So I M Looking For A Code To Search For A Certain Record In A Database How Do I Go About It
tau is offline   Reply With Quote
Old Dec 6th, 2007, 1:17 AM   #2
venkatramasamy
Newbie
 
Join Date: Oct 2007
Location: INDIA
Posts: 22
Rep Power: 0 venkatramasamy is an unknown quantity at this point
Send a message via AIM to venkatramasamy
Post Re: Searching A Record

HI Tau,

The details you furnished is not sufficient to guide you on right direction, the reason no information provided about the direction you want to go,

just tell me what database you are using like MS access, Oracle, SQLServer

Usually beginers use MS access...

if it so...

i assumed that there exists an Db named as MYDB.Mdb
create the database base connection
dim cn as new Adodb.Connection
dim rs as new adodb.recordset
dim strfound as boolean
cn.open (Provider=MSDASQL.1;Persist Security Info=False;Extended Properties="DBQ=C:\MYDB.mdb;DefaultDir=C:\;Driver={Driver do Microsoft Access (*.mdb)};DriverId=281;FIL=MS Access;FILEDSN=C:\MYDB.mdb.dsn;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;")

rs.open "select *from samp"
Strfound=false
if rs.reordcount>0 then
     rs.movefirst
      For i=0 to rs.recordcount-1
     if strcmp(rs.fields(fileldindex),searchvale,vbtextcompare)=true then
    strfound=true          
end if
      rs.movenext
Next      


end if

if strfound=true then
msgbox "Record Found"
else
msgbox "Record Not Found"

i hope the code will help

the code above furnishes was not cheked it simple guide line only you may need to make slight changes on it

all the best

With regards
venkatramasamy SN

Last edited by cscgal; Dec 6th, 2007 at 3:35 AM. Reason: Code tags
venkatramasamy is offline   Reply With Quote
Old Jul 21st, 2008, 9:08 AM   #3
Steel9561
Newbie
 
Join Date: Apr 2008
Posts: 8
Rep Power: 0 Steel9561 is on a distinguished road
Re: Searching A Record

You also can use a filter with VB6 and ADO which basically will let you perform better searches using the format "recordset.filter=". You can find more info about this on this site:

http://p2p.wrox.com/topic.asp?TOPIC_ID=6785
Steel9561 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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 On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
searching for book Lesliect6 Coder's Corner Lounge 6 Jul 1st, 2007 6:09 AM
searching for 2D arrays within 2D arrays HammerCat C++ 9 Mar 14th, 2006 9:16 AM
Searching for html pages Zapper HTML / XHTML / CSS 2 Aug 26th, 2005 9:26 AM
Java - Searching a table in a database - small problem. Vengeance Java 4 Apr 28th, 2005 2:53 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC