| | |
using find command in two given variable
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2007
Posts: 47
Reputation:
Solved Threads: 0
I want to use find command for searching file in the database, but if I add "and" command i received error. It is possible to use and in Find command
I try to this syntax but it is error
.Open "Select *From salary'", strconek, adOpenStatic, adLockOptimistic
.Find "empno = '" + vempno + "'" and "salary_month = '"smonth"'", 0, adSearchForward
if not (.eof)
msg existing
else
accept data
endif
Anybody can help me to fix this error or anyone have idea what command to use for searching a file.. The main purpose of me is to chech the employeenumber and salaryofthemonth if existing or not..
what command I will use to seek both employee number and salaryofthemonth as joint conditional statement for searching file in the database.
thanks in advance
I try to this syntax but it is error
.Open "Select *From salary'", strconek, adOpenStatic, adLockOptimistic
.Find "empno = '" + vempno + "'" and "salary_month = '"smonth"'", 0, adSearchForward
if not (.eof)
msg existing
else
accept data
endif
Anybody can help me to fix this error or anyone have idea what command to use for searching a file.. The main purpose of me is to chech the employeenumber and salaryofthemonth if existing or not..
what command I will use to seek both employee number and salaryofthemonth as joint conditional statement for searching file in the database.
thanks in advance
You're already using the query so why not maximize the usage of it?
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
" Select * From Salary Where empno = '" & vempno & "' And salary_month = '" & smonth & "' "
A conclusion is the place where you got tired of thinking. http://www.martin2k.co.uk/forums/index.php?showforum=4
http://www.a1vbcode.com/a1vbcode/vbforums/Forum3-1.aspx
http://www.developerfusion.co.uk/for...orum&ForumID=4
you can't use find method on more than one column. ADO's Recordset.Find method works on one column, and one column only. why do you want to use Find? Although it is appropriate in some situations, using it to locate records is generally very inefficient, in terms of speed and memory. Find works by examining each record in a Recordset for the criteria you give it after you have created the Recordset and retrieved all the data from your database. Retrieving lots of unwanted records, particularly down the wire from a server, when you are really interested in only a handful, or sometimes just one row of data. This creates a lot of unnecessary overhead. Unless you have a very compelling reason for using Find, I'd recommend using an alternative approach, like filtering your Recordset or using SQL, for serious performance gains.
The Recordset.Filter method filters out records that don't match one or more criteria. You can specify multiple conditions in a filter by using 'AND' or 'OR', so using Filter would allow you to check multiple columns. For example, suppose we open a Recordset and execute the following code:
rs.Filter "Country='India' and Place='Delhi'"
The Recordsetrs would then contain only records where the Country and Place fields were India and Delhi, respectively. If no records existed that match these criteria, rs would be empty, with rs.EOF and rs.BOF both true. To remove a filter from a Recordset, set the Filter property to an empty string ("") or the constant adFilterNone.
OR Lastly use a SQL SELECT statement to ensure that the Recordset contained only records with the values you are looking for. SQL processing is done by the data provider and is generally the fastest way to retrieve a restricted set of data because the only real overhead is the opening of the Recordset, which you have to do anyway.
Regards
Shaik Akthar
The Recordset.Filter method filters out records that don't match one or more criteria. You can specify multiple conditions in a filter by using 'AND' or 'OR', so using Filter would allow you to check multiple columns. For example, suppose we open a Recordset and execute the following code:
rs.Filter "Country='India' and Place='Delhi'"
The Recordsetrs would then contain only records where the Country and Place fields were India and Delhi, respectively. If no records existed that match these criteria, rs would be empty, with rs.EOF and rs.BOF both true. To remove a filter from a Recordset, set the Filter property to an empty string ("") or the constant adFilterNone.
OR Lastly use a SQL SELECT statement to ensure that the Recordset contained only records with the values you are looking for. SQL processing is done by the data provider and is generally the fastest way to retrieve a restricted set of data because the only real overhead is the opening of the Recordset, which you have to do anyway.
Regards
Shaik Akthar
![]() |
Similar Threads
- How to run a *.exe file in Java (Java)
- Dev-C++ - [Build Error] [main.o] Error 1 (C++)
- help a newbie? mySQL find & replace (MySQL)
- find online users (Shell Scripting)
- HELP!!!need help with command line arguments and creating a package in java. HELP!!!! (Java)
- Photoshop - javascript slice : error : copy command not available?? (JavaScript / DHTML / AJAX)
- how do you set a variable to be a filename? (C)
- Passing a variable with a password to the SU command (Shell Scripting)
- i use perl (Perl)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: label disappears
- Next Thread: How I Creat Shortcut of My Project On Desktop
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp c++ calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sort sql sql2008 sqlserver struct subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





