« first day (90 days earlier)      last day (102 days later) » 

03:09
Morning
Good Morning
 
1 hour later…
04:38
0
Q: C# to Access SQL query based on UI controls

B.K.I have a WPF application (using MVVM pattern) that allows users to perform a search for a record/records based on their selection choices and entries into the different UI controls (TextBox, CheckBox, RadioButton, DatePicker, TimerPicker,etc). It does this by retrieving information from an Acces...

@B.K. how much records are containing in ur database table?
05:14
@Wulworine 130,715 in the main table. I join with two other tables that contain roughly 2x to 3x more records each.
actually i was thinking about DataView to filter available records. but, it needs all records to be populated first time.
but, the amount of ur record is too large and it would takes 5 to 15 second to load all data in a dataview.
if the table structure is well maintained and all indexes are created properly
The way I have it implemented now it takes on average 5 to 15 seconds (just like you said) to find the record.
See another problem is that new records come in all the time. It's not like I can just load in the data in the background as the program is starting up and then filter though it. Each time a user runs a query, there could be several new records added or deleted prior to the query.
By the way, I like your website design.
thanks.. but, i did not created that... Im a Windows Developer.. my friend has given that design
i think the method of fetching data is correct but, u need to improve some code for generating query
05:24
I figured it was a template, because a lot of it is not changed from the defaults yet, but it still looks pretty nice. :)
Definitely, that's what I'm having the issue with.
That method is too large.
yeah actually i havnt time to update it
Time is the most expensive thing in life... I know how you feel.
i like simple designs like that... coz.. it may be faster then others
I'm all for minimalism.
if (!String.IsNullOrWhiteSpace(EmployeeId))
    {
        if (!String.IsNullOrWhiteSpace(query.ToString()))
        {
            query.Append(" AND ");
        }

        query.Append("Employee_ID LIKE '%" + EmployeeId + "%'");
    }
in ur above code why don't u add "AND" with the condition
like this
if (!String.IsNullOrWhiteSpace(EmployeeId))
    {
        query.Append(" AND Employee_ID LIKE '%" + EmployeeId + "%'");
    }
and at the declaration of query object
add default value like "1=1"
@B.K.
05:29
Because there could be nothing before that addition.
That part could be the very first added into the query string.
So if I have AND in front of it, it's an invalid query.
but, u can avoid it by adding default condition like
1=1
for example WHERE 1=1 AND FName Like 'ABC%' AND LName Like 'XYZ%'
it does not affect on execution performance
and also it does not affect on ur query result
and use query.AppendFormat() instead of query.Append()
What does 1=1 do?
nothing
Ah, so it's a filler.
That's actually a neat idea, I'll give it a try. Be right back.
its a filter condition just like when u create infinite loop using While(true)
it will returns true
and use AppendFormat like this
query.AppendFormat(" AND Employee_ID LIKE '%{0}%'",EmployeeId);
05:51
Tested out your suggestion. It works and it shortened my code. :)
Thank you.
Something I was told on another chat, though, which I have not considered, is SQL injections, so that'll be one of the things I'll have to adjust for. Almost considering learning Entity Framework..
yeah that's also good suggestion to create stored procedure for it
What do you mean?
executing query like this causes the security issue and hacker can easily inject sql injection in it
Definitely.
delete all and i'm done
so, it is better to use query parameter or stored procedure
05:55
Yeah, I don't know what either one is. Limited experience with databases.
do u know stored procedure?
I have an idea of what it is, but now how to create one or use it.
the structure of stored procedure is very easy
My db experience does not extend far beyond the basics of Access and SQLite
create procedure sp_yourSPName(@parameter1 varchar(max) = null, @parameter2 varchar(max) = null)
As
Begin
    -- Write ur code here
End
06:00
So it's basically like a method, but of SQL type?
Hmm..
Would make my query a lot easier.
I shall have to learn it then. :)
You know, you've been a lot of help to me tonight. I really appreciate that. It's good to meet someone nice.
yeah thanks... but, it's day here.. now it is 11:30 AM
Oh, heh. India, right?
ok look at this example
yeah India
79
A: How can I use optional parameters in a T-SQL stored procedure?

KM.Dynamically changing searches based on the given parameters is a complicated subject and doing it one way over another, even with only a very slight difference, can have massive performance implications. The key is to use an index, ignore compact code, ignore worrying about repeating code, you m...

just like what u want
06:05
OMG, that is exactly what I want.
That is incredible... I've searched all over SO and couldn't find it. Thank god for a second set of eyes.
BTW @B.K. what's ur actual name?
Why?
just asking.. if u want to tell me otherwise it's ok
Well, first name is Bogdan.
:)
You?
Nimesh
06:21
Pleasure to meet you, Nimesh.
Nice to meet u too @B.K.
@Wulworine If you want to post your answer for my question, I'll gladly accept it, because that is 100% what I was looking for.
weeks of headache -- gone
hey all .. need urgent help .. stackoverflow.com/questions/23780006/…
3
Q: Formula in Excel using NPOI

Tarun MathurI am using NPOI dll for genrating excel sheet in C#. When I apply formula on some cell programmatically and export excel then in protected mode of excel sheet all the cells having formula show '0' value. but when i edit this excel all formulas work properly on those cell. Is there any solution f...

welcome @NMathur
but, sorry i m not familiar with NPOI dll.
Well, Nimesh, I'm off, thanks for all of your help and hopefully we'll chat again.
06:34
ok.. @B.K. BTW what is the time now there?
11:34 PM (Southern California)
its 11:30 mins difference
ok c u later
Have a good day. :)
have a sweet dream... :)
 
3 hours later…
09:53
hello there, can any one tell me the solution for my problem?? my problem is i cant able to start cmd prompt in c# after i hosted on IIS. should it be any permission Issue??

« first day (90 days earlier)      last day (102 days later) »