|
So you're saying I'm not decent?
If I had a sig, it would probably go here.
|
|
|
|
|
Please take a look here.[^]
The smiley should have been hint enough.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
|
I want that create and print report with c#
but i want do every thing by code and don't use any option in visual studio
please help me
|
|
|
|
|
What part, specificly, are you having trouble with?
I get all the "news" I need from the weather report.
|
|
|
|
|
i just write this code in class named BindReport
public DataSet GetDataSet()
{
SqlConnection sqlconn = new SqlConnection(_connectstring);
SqlDataAdapter DA = new SqlDataAdapter("select aman_no,aman_name,aman_area from aman", sqlconn);
DataSet ds = new DataSet();
DA.Fill(ds,"aman");
return (ds);
}
and this code in form load
BindReport obj = new BindReport();
DataSet ds = obj.GetDataSet();
CrystalDecisions.CrystalReports.Engine.ReportDocument myRPTDocu = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
myRPTDocu.Load(@"..\..\CrystalReport2.rpt");
myRPTDocu.SetDataSource(ds);
crystalReportViewer1.ReportSource = myRPTDocu;
and this code not work and give me exception "the report has no tables"
|
|
|
|
|
Hi,
I have the following situation and struggling with it. So hopefully someone can solve it or perhaps advice me another method. What I have is an Excel spreadsheet and a c# program.
In the program i load the excelsheet into a datatable
<br />
Cursor = Cursors.WaitCursor;<br />
InitExcel(ref _exr);<br />
_dt = _exr.GetTable();<br />
So far so good. I can than loop trough the rows from the datatable like this
foreach (DataRow da in _dt.Rows)<br />
{
and so on. What i would like to achive now is the following. In my datatable there are many rows. I would like to group rows where a certain column has the same value. It is a fact that rows where this is the case are underneath each other. So it thought lets move to the next row to see if the value is the same. if so read some columns and move on to the next row and do the same check. If the value is the same read the samen columns. If not i have another row and start over again. The result should than look something like
Source table
100;Nice product;100.0;Variant 0
100;Nice product;100.1;Variant 1
100;Nice product;100.2;Variant 2
200;Another nice product;200.0;Variant 0
200;Another nice product;200.1;Variant 1
200;Another nice product;200.2;Variant 2
100 Nice product
....100.0 Variant 0
....100.1 Variant 1
....100.2 Variant 2
200 Another nice product
....200.0 Variant 0
....200.1 Variant 1
....200.2 Varian 2
and so one. but i have not got a clue how to do this. I cannot figure this out. A bad but working solution is to add the datatable to a hidden grid on the form and perform this actions on the grid. but that is not the solution i am looking for
Hope this makes any sense and that someone can help me solve this issue
Kind regards,
Marcel Vreuls
http://www.marcelvreuls.com
< >
|
|
|
|
|
in datatable u have a function called select(query)
u can use that will solve ur problem
it will get the collection of rows having the same column value and returnit as a row[].
ex
---
DataTable table = DataSet1.Tables["Orders"];
// Presuming the DataTable has a column named Date.
string expression;
expression = "Date > #1/1/00#";
DataRow[] foundRows;
// Use the Select method to find all rows matching the filter.
foundRows = table.Select(expression);
// Print column 0 of each returned row.
for(int i = 0; i < foundRows.Length; i ++)
{
Console.WriteLine(foundRows[i][0]);
}
}
with Regards
Amjath
|
|
|
|
|
Thanks Amjath,
this one works exellent for my. Sometimes the solution is simple
Kind regards,
Marcel Vreuls
http://www.marcelvreuls.com
< >
|
|
|
|
|
I'm getting this error, any idea why?
Error:
'DerivedClass': member names cannot be the same as their enclosing type
Code:
using System;
namespace TestConsole
{
public class TestOne
{
public static void Main()
{
}
}
public class PersonDetails
{
private string foreName;
//read only property because it only has a 'get' clause
public string ForeName
{
get
{
return foreName;
}
}
protected void SetForeName(string value) {
foreName = value;
}
}
public class DerivedClass : PersonDetails
{
public DerivedClass() {
base.SetForeName("Joey"); } //error
}
}
Jon
|
|
|
|
|
Hi Jon,
the code shown seems correct. If it actually is what is in your project,
I suggest you close Visual, reopen it and retry (with Rebuild Solution, so it
throws away all existing output files).
|
|
|
|
|
Cheers for that
Jon
|
|
|
|
|
Hi!
The code you have posted is correct and can be compiled without problems.
Please try again or post the code that's actually giving the error.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Change the name of the base class method "SetForeName" to something other than that. Its the cause of your exception.
Phil
|
|
|
|
|
It's not being compiled with VS2005 somehow....that's where the problem is
Jon
|
|
|
|
|
Did it compile now after restarting VS, like Luc suggested?
All I can tell you is that exactly the code you posted can be compiled just fine on my PC with VS2005. So either you didn't post the exact code or your C# compiler is screwed up in a very strange way...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hi im working on an application to update a flash website , ive made a form with a WebBrowser control which im using as a local preview .
Im trying to figure out why the preview isnt working correctly , my onclick events arent working and it isnt importing the images correctly .
it works fine in ie but im getting ie script errors in the program which is weird because its scope is set to a swf
Is their any way to get this preview working
|
|
|
|
|
I want to create a windows form localized to Amharic language(Ethiopia). What is the use of UTF8 Files with localization? i have got some am_ET.UTF8 File, is there any thing related to this and may help localizing applications created using C#?
Anyone with know how, please let me know.
|
|
|
|
|
I've never really dealt with localization since many of my projects are for client internal use locally here in the US. Have you looked at any localization articles on this site? If I recall, there are some pretty good ones
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Yegojjam Lij wrote: i have got some am_ET.UTF8 File, is there any thing related to this and may help localizing applications created using C#?
http://www.fileinfo.net/extension/utf8[^]
I never came across this file extension before, but it looks like it's ordinary text file in UTF8 encoding - not related to .NET localization features.
As other person said, there are lot of articles about globalization/localization in .NET (I'd post you some links from MSDN but 56k is no-no for MSDN
OT: Firefox suggests "globalization" to be spelled as "cannibalization"
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
I start four threads after each other because I want them to run simultaneously, the problem is that they only run one at a time.
The other threads has the state "WaitSleepJoin".
Any idea why this could be?
starting them with the code below, dThreads is an ArrayList:
dThreads.Add(new Thread(new ParameterizedThreadStart(test)));
string s = offset + ";" + (offset + partSize) + ";" + i;
((Thread) dThreads[i]).Start(s);
|
|
|
|
|
Cant tell from the little you told us. Do you care to show more of the code ?
what is i ? are you doing something with priorities ? are there any Thread.Sleep ?
what's inside the test() method: is there any locking involved, explicitly or implicitly ?
etc.
if you want to solve this by yourself: add timestamps to the major actions;
this is the log method I would suggest you use:
public void log(string s) {
int ID=Thread.CurrentThread.ManagedThreadId;
s=DateTime.Now.ToString("mm:ss.fff")+" ["+ID.ToString("X4")+"] "+s;
Console.WriteLine(s);
}
Now insert log statements "everywhere", at least at the start and end of the test method,
and right before your line ... .Start(s); use the string argument to describe what you are
going to do, or just did.
|
|
|
|
|
Thanks for the reply, yes I was vague, sorry.
What I'm doing is downloading a file, in four parts.
These parts should download at the same time.
I have one download-class that I call four times.
So I'm doing four threads that each starts a new thread in the download-class.
There is no sleeping or locking.
private ArrayList downloads;<br />
private void StartDownload()<br />
{<br />
downloads = new ArrayList(1);<br />
dThreads = new ArrayList(1);<br />
webRequest = (HttpWebRequest)WebRequest.Create(downloadUrl);<br />
if (!dowloadProxy.Equals(string.Empty))<br />
webRequest.Proxy = new WebProxy(dowloadProxy);<br />
webRequest.Credentials = CredentialCache.DefaultCredentials;<br />
webResponse = (HttpWebResponse)webRequest.GetResponse();<br />
int fileSize = (int)webResponse.ContentLength;<br />
<br />
int partSize = fileSize / parts;<br />
int lastPart = fileSize - partSize * parts;<br />
<br />
int offset = 0;<br />
for(int i=0; i<parts; i++)<br />
{<br />
dThreads.Add(new Thread(new ParameterizedThreadStart(test)));<br />
string s = offset + ";" + (offset + partSize) + ";" + i;<br />
((Thread) dThreads[i]).Start(s);<br />
<br />
offset += partSize;<br />
<br />
if (i == parts - 2)<br />
partSize += lastPart;<br />
}<br />
}<br />
<br />
private void test(object nums)<br />
{<br />
string[] split = ((string) nums).Split(';');<br />
int start = Int32.Parse(split[0]);<br />
int stop = Int32.Parse(split[1]);<br />
<br />
downloads.Add(new Download());<br />
i = downloads.Count - 1;<br />
<br />
((Download)downloads[i]).StartPoint = start;<br />
((Download)downloads[i]).EndPoint = stop;<br />
<br />
((Download)downloads[i]).InitDownloadFile(downloadUrl);<br />
((Download)downloads[i]).DownloadFile(outFile + "." + i);<br />
}<br />
|
|
|
|
|
Hi,
I have a few minor comments, that AFAIK dont relate to the problem:
- you create ArrayList instances with initial capacity=1, this is not wrong but also not
very useful. I would either not specify a capacity at all, or something that is likely
to be sufficient (4 in your case).
- you have if (i == parts - 2) partSize += lastPart; at the end of the for loop;
it would look more natural to have if (i == parts - 1) partSize += lastPart; at the
beginning of the loop. (its the last iteration that is special, not the last but one).
- you have downloads.Add(new Download()); i = downloads.Count - 1;
this is a weakness, if not a bug: if another thread runs the same test method and gets
switched in, then back out, your value of i might no longer point to the download you
just created. The solution is simple, and avoids those ugly casts later on:
Download download=new Download;
downloads.Add(download);
download.StartPoint=Start;
...
But overall it all seems OK, the problem I suspect is in the Download class; for one
reason or another (assuming your observations are right) the 4 downloads are not working
concurrently. So thats where you must look for locks, bottlenecks, or insufficient
resources.
I still am inclined to add logging with timestamps to see what happens when; I would
rather get more facts than try and formulate hypotheses about what might be happening
that would match the symptoms lacking some fundamental information.
Hope this helps.
|
|
|
|
|
Hi,
sorry, some more comments:
- I missed the declaration and initialization of "parts"; are you sure it holds value 4 ?
- you seem to have a special way of passing several parameters to the test method.
.NET 2.0 has a new Thread.Start overload that supports multiple parameters.
An alternative is to use a class (say DownloadJob) that has a constructor with parameters
(or some public properties) and basically does what test does; you then create a
downloadJob isntance, make sure its parameters
are set the way you want (thru constructor or properties), then launch it.
So you probably dont need the downloadJobs arraylist any longer.
- you could as well add the above parameter handling to the existing Download class itself,
hence create Download instances and set parameters before creating the threads and
causing the Download method to run.
- and the next logical step is to move the thread creation inside the Download or
DownloadJob class itself;
so in the end you just create four jobs and launch them; the jobs are smart enough to each
create their own thread and run on it.
But again, this is, as far as I can see, not really where the problem is.
|
|
|
|