![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2007
Posts: 1
Rep Power: 0
![]() |
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
|
|
|
|
|
|
#2 |
|
Newbie
|
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 |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Apr 2008
Posts: 8
Rep Power: 0
![]() |
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
__________________
Opening you the door to success in the best freelance website: Rent a Coder |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
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 |