|
12 hours later you give the same response. That's the way to boost your rep
How about next time you read the previous responses before posting.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
No no no, that would be unfathomable!
...
...
...12 hours later...
no no no, that would be crazy!
|
|
|
|
|
Dear friends
I am a beginner in C#.NET programming. I have a problem to create a report.
I want to inter two dates in a form and when I push the button all data between these date shows on a report.
Please help me by sending all codes I need or by a sample
Thank you
Nasser Hosseini
|
|
|
|
|
N_Hosseini wrote: by sending all codes I need
No. We are not here to do the work for you.
We will help you along the way though. First tell us what type of report, SSRS, Crystal, something else? Where is the data coming from? You left it very vague and no answer can be given.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks
I created a form with two textboxes and a button. I want to inter two dates in textboxes (beginning date and ending date) and click the button and a crystal report shows all goods, quantity of goods and sales price from sales table in the crystal report.
I use below codes
Please help me to complete them
Please check my codes and help me
private void btnshow_Click(object sender, EventArgs e)
{
string connectionString = "server=.;database=siman;trusted_connection=true";
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand command = new SqlCommand("select goods, quantity, price from sales where saledate betwee "+txtbeginingdate.text+" and"+txtendingdate, connection);
command.CommandType = CommandType.Text;
SqlDataAdapter adapter = new SqlDataAdapter(command);
DataSet ds = new DataSet();
adapter.Fill(ds)
DataTable dt = new DataTable();
????????
connection.Open();
???????
connection.Close();
CrystalReport1 rptresult = new CrystalReport1();
?????
}
|
|
|
|
|
First, please format any code you post using the pre tags (i.e. code block). You will get better results if you learn to follow the guidelines here.
N_Hosseini wrote: SqlCommand command = new SqlCommand("select goods, quantity, price from sales where saledate betwee "+txtbeginingdate.text+" and"+txtendingdate, connection);
It is extremely dangerous to accept unformatted and filter input directly from user controls. Ever heard of SQL Injection Attack?
You need to learn how to use SqlDataAdapter[^]
DataTable dt = new DataTable();<br />
connection.Open();
These lines are useless.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
hi, is it possible to add a new table to sql from a form at runtime? If yes, would you please just give me a clue? I can manage the rest
|
|
|
|
|
teknolog123 wrote: hi, is it possible to add a new table to sql from a form at runtime? If yes, would you please just give me a clue? I can manage the rest
Here is the clue.
|
|
|
|
|
thanks
|
|
|
|
|
hey all,
I've GUI application, which executes some logic application,
i do it with backgroundworker.
in the simple way (no operation progress update)it works fine, but when i'm trying to update an operation
progress, i get this exception...
my main idea : GUI with some user controls (main thread) then i execute another worker thread, while it works i'm listening to event it rise (each time when the upgrade point was reached), and when i'm catching this event in the main gui thread, i would like to update some label control...
I read about invoke etc... but it doesn't work with backgroundWorker.
any idea for solution will be appreciated
thanks
|
|
|
|
|
BackgroundWorker has progress reporting built in. Use this functionality and the ProgressChanged event will be fired on your UI thread for you.
Nick
|
|
|
|
|
This[^] should certainly help you out.
Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
thanks both of you, it really helped me !!!
one more question,
is there a method to implement a "pause" button for running thread ?
i guess when i use backgroundWorker.CancelAsync(); current working thread is die...
what i want is to make it pause, and on my request, to be continued from the place it was stopped..
|
|
|
|
|
BackgroundWorker does not have Thread.Suspend and Thread.Resume, so I suspect you will have to do it manually:
1) Set up a class level bool accessable to both the main and BackgroundWorker threads.
2) Set the bool true in the main thread when you want to pause the worker, and false when you want to resume it.
3) In the worker thread, monitor the bool on occasion, and while it it true, use the Sleep method for a suitable interval - half a second or so, depending on how fast you want it to start continuing.
Or better, replace the bool with a ManualResetEvent[^]
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
thanks for the answer,
I'll try it
|
|
|
|
|
I am retrieving a filepath that I need in my program using a folderBrowserDialog. Can anyone tell me how to change all the back slashes to forward slashes?
Thanks
Darrall
|
|
|
|
|
string withForwardSlashes = withBackwardSlashes.Replace('\\', '/');
or
string withForwardSlashes = withBackwardSlashes.Replace("\\", "/");
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
I tried it exactly as you have it there and I get "Too many characters in character literal" and "No overload for method
'Replace' takes '1' arguments."
Any thoughts?
Thanks for your time.
Darrall
|
|
|
|
|
Works fine for me - could you post the code fragment exactly as you have it?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Here it is
private void button2_Click(object sender, EventArgs e)
{
string OldPathName;
string NewPathName;
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("MyFolder = " + folderBrowserDialog1.SelectedPath);
textBox1.Text = folderBrowserDialog1.SelectedPath;
OldPathName = NewPathName.Replace ('\','/');
}
|
|
|
|
|
Backslash is an escape character. The '\' you entered is interpreted as '' . You can change that to @'\' or '\\' and it should work.
Don't blame me. I voted for Chuck Norris.
|
|
|
|
|
Thanks Somewhere along the line I think C# should have left the backslash alone.
|
|
|
|
|
Using an other character would probably be worse, since so many* languages use the backslash as escape character..
* Perl, Python, Java, ECMAScript, C, C++, PostScript, RTF, awk, sh and many others
|
|
|
|
|
I take it from the other responses that that problem is fixed? Now change your code slightly to make it actually work!
private void button2_Click(object sender, EventArgs e)
{
string OldPathName;
string NewPathName;
if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
MessageBox.Show("MyFolder = " + folderBrowserDialog1.SelectedPath);
NewPathName = folderBrowserDialog1.SelectedPath;
textBox1.Text = NewPathName;
OldPathName = NewPathName.Replace ('\\','/');
}
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Darrall wrote: Any thoughts?
Yes, two:- Did you type carefully?
- Post your code if you want us to help you fix it.
/ravi
|
|
|
|