Create a form with 3 text boxes a button (Search) and a grid.
when the user clicks the search button trap the event and
make a connection to the database
pass in the query based on the data entered into the textboxes (using PLs query example)
get the dataset from the sql command object
bind the datatable to your datagridview
Improve the query by using parameters - see "Little Bobby Tables"
Never underestimate the power of human stupidity
Create a class Criterion with 4 string properties: Name, Operation, Value, SecondValue - yes, the SecondValue is required in such rare case like that "between". Also create a collection class for it, e.g. Criteria:List<Criterion>.
The most complicated part is the ToSQL() of Criterion. In many cases, simple concatenation will suffice.
Then start your query with string query = "SELECT * FROM MYTABLE WHERE 1=1 "
then simply iterate thru the collection and add query += " AND " criterion.ToSQL();
Well, that is still open to SQL Injection. Update the ToSQL function and do another loop to add the parameters then (next step - doing it in one step is surely still beyond your level, but with two steps, you could do it).
Sounds like a deal - but only if I get the domain thrown in.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
my sql server procedureis"
Collapse | Copy Code
CREATE PROCEDURE [dbo].[Attendence]
if not exists(select * from TblAttendence where convert(varchar(10) ,CreateDate,23) =convert(varchar(10) ,GETDATE(),23) and EmployeeId =@EmployeeId)
select * from TblAttendence where convert(varchar(10) ,CreateDate,23) =convert(varchar(10) ,GETDATE(),23) and EmployeeId =@EmployeeId
update TblAttendence set LastLoginTime=GETDATE() where EmployeeId=@EmployeeId and convert(varchar(10) ,CreateDate,23) =convert(varchar(10) ,GETDATE(),23)
i am working on lexical analyzer phase of compiler construction.... i have written a code that display a that the given number is real if it contain one dot int it but if it contains two dot i does not generate error....
here is my code
bool containReal = ss.Any(char.IsDigit) && ss.Contains('.');
MessageBox.Show("this is a Real Number");
//invalid b/c of two dots
string str2 = ss.Substring(1, ss.IndexOf('.'));
string str3 = ss.Substring(ss.IndexOf('.') + 1);
bool chk_dot = (str2.Any(char.IsLetter) || str3.Any(char.IsLetter) || str2.IndexOfAny("!@%^&*()#$-_+<>".ToCharArray()) != -1 || str3.IndexOfAny("!@%^&*()#$-_+<>".ToCharArray()) != -1);
if ( chk_dot)
MessageBox.Show("Error: Line num " + linecount + " Invalid b/c of two dots in a real number");
Help you with what? All you've given us is a statement that doesn't make any sense and no context information to work with. We have no idea what you're doing, what your code is doing, what you expect it to do, what it's actually doing, any error messages you're getting, ..., absolutely NOTHING to work with.
You've basically walked into a room with a bunch of people who don't know you and said "Error msg conveying that a number is invalid because of Two dots within a real number in c#" and then walked out of the room. Everyone in the room is now thinking "Who the hell was that guy and what was that about?"
I take a picture with webcam and save it whit name "A" at desktop (fixed)
How can I open it without using opendialog and select it?
I want to click a button and winform default open image with name "A" and path.
Thanks for your help
Last Visit: 31-Dec-99 18:00 Last Update: 1-Aug-14 2:28