|
i try to use data table but it show same problem i don,t know what's wrong 
|
|
|
|
|
As I said - from the data you showed, it looked right - what are you expecting to see?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
data in chart not like in my database
ID_Product = 14 have quantity 19 at(26/1/2555) ,1 at(28/1/2555) ,8 at(29/1/2555)
and
ID_Product = 18 have quantity 1 at(25/1/2555) ,1 at(27/1/2555) ,5 at(28/1/2555) and 3 at(29/1/2555)
but in chart why shown same value
please help me i'm stuck this problem for 2 day if i fix this ploblem it's will help for my project to much 
|
|
|
|
|
Ah. Ok. that makes some sense.
You are using the same data values for each series: I'm not sure exactly what you need to do to fix that (I don't use the Microsoft Chart control) but it looks like a Chart control always takes it's data from a single table. This is taken and adapted from their example:
DataTable table = new System.Data.DataTable("Table1");
table.Columns.Add("Category", typeof(String));
table.Columns.Add("Value", typeof(Double));
table.Columns.Add("SecondValue", typeof(Double));
table.Rows.Add(new object[] { "Lost", 0, 17 });
table.Rows.Add(new object[] { "Very Good", 1, 5 });
table.Rows.Add(new object[] { "Good", 2, 0 });
table.Rows.Add(new object[] { "Unlikely", 3, 9 });
table.Rows.Add(new object[] { "Firm Order", 4, 1 });
DataSet set = new DataSet();
set.Tables.Add(table);
chart1.DataSource = set.Tables[0].DefaultView;
chart1.Series["Series1"].XValueMember = "Category";
chart1.Series["Series1"].YValueMembers = "Value";
chart1.Series.Add("Series2");
chart1.Series["Series2"].XValueMember = "Category";
chart1.Series["Series2"].YValueMembers = "SecondValue";
chart1.DataBind();
This does show two independent data plots, but from the same table. If it is the case that it always works from the same table, then you will have to either change your SELECT statement to return multiple columns (a PITA when you are dealing with user-selectable columns) or manually create a table, create the columns you need and add the data points to the appropriate columns. Not difficult, but fiddly and a bit messy. There may be an easier way, but I don't know what it is.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
I would go for a single SQL statement that fills a single table with all required information, it would look somewhat like this:
select NAME_Product from Product where Product.ID_Product IN ( '"+str1+"' ", '"+str2+"' ", '"+str3+"' )
and you may want to append GROUP BY Product.ID_Product
So you would need:
- a loop to build the one SQL statement
- the execution of that SQL stm resulting in one DataTable
- a loop to tell your chart where to find all the data series
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
|
How can we write the long source of a program in
2 or 3 files and relate them together at build time.
|
|
|
|
|
|
I rather think he has five source-files (.cs) that should be linked to a single executable. The IDE does that for us
Bastard Programmer from Hell
|
|
|
|
|
The question (as with so many) is somewhat open to interpretation.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Yes, but the wording "two or three files" are a give-away.
..with everybody recommending on how to distribute classes over multiple files
Bastard Programmer from Hell
|
|
|
|
|
Which is why I made the suggestion that I did.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
better way is to ask for more information about the question.!!!
@faraz34 : what exactly you would like to achieve ? whats your problem ?
thanks
-Amit.
|
|
|
|
|
Not at all; I gave an answer which may be the right one. If not then OP can respond with more details.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
the ways of an MVP, you should treat with the greatest respect!
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
If you referring to writing classes with an extensive amount of code. Then I'd suggest you use the "partial" key word. That way you can spread your class over separate files. In each file you just call the full declaration of the class but with the partial key word. Eg;
public partial class Employee
{
public void DoWork()
{
}
}
public partial class Employee
{
public void GoToLunch()
{
}
}
http://msdn.microsoft.com/en-us/library/wa80x488%28v=vs.80%29.aspx[^]
|
|
|
|
|
faraz34 wrote: How can we write the long source of a program in
2 or 3 files and relate them together at build time.
1. Design your application so that you can break the functionality into classes. Classes normally are rather small. This step has nothing to do with actually writing code.
2. Implement each class in a different file.
3. In C# you put all of the classes in a project which is then managed via a solution.
|
|
|
|
|
jschell wrote: 3. In C# you put all of the classes in a project which is then managed via a
solution.
You mean "in Visual Studio"; C# neither knows nor cares about projects and solutions.
|
|
|
|
|
csc /out:My.exe *.cs
Will compile all .cs files within that folder into My.exe. Snippet taken from MSDN[^].
Bastard Programmer from Hell
|
|
|
|
|
Yes, but I use /recurse:"*.cs"
|
|
|
|
|
In addition to using *.cs you can also put the specific files:
csc MyFirstClass.cs MySecondClass.cs etc.cs
The name of the first will be used to name the output (i.e. MyFirstClass.exe in this case) unless you specify a /out: target.
IDEs generally hide this away from you – are you writing code in a text editor? You don't normally need to do that, as there are good free IDEs available for .Net.
|
|
|
|
|
Hi I would like to use argument in ThreadStart Delegate but I have problem with syntax. here the code example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace mtquestion
{
class Program
{
static void Main(string[] args)
{
Thread T1 = new Thread(new ThreadStart(C(15,25)));
Thread T2 = new Thread(new ThreadStart(C(15, 29)));
Thread T3 = new Thread(new ThreadStart(C(18, 25)));
T1.Start();
T2.Start();
T3.Start();
object locker = new object();
lock (locker)
T1.Join();
T2.Join();
T3.Join();
lock (locker)
Console.Write("c");
}
public static void C(double a, double b) { Console.WriteLine(a*b);}
}
}
the syntax
Thread T1 = new Thread(new ThreadStart(C(15,25)));
return the following error"method name expected"
How can I pass arguments?
Thanks for your time
|
|
|
|
|
In order to pass arguments, you need to look at using a ParametrizedThreadStart instead:
Thread T1 = new Thread(new ParameterizedThreadStart(Y));
T1.Start(42);
...
public static void Y(object i) { Console.WriteLine("Hello: "+ i); }
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
Thanks a lot for answer
Just last help: suppose I need many parameters let's say a double, a DateTime[] and a Dictionary<>,
How can I manage only using the parameter (object i).
To be more clear, I have something like:
public static void Y(double a, DateTime[] myDates, Dictionary<string,double> myDic)
I suppose there is a workaround to fit all in object and using casting.
thanks for your time
|
|
|
|