|
or fetching a page into a string like so[^].
|
|
|
|
|
Hi.....
I have combobox which gives table list.After selecting table from same then crystal report view must show table data.
I got problem with crystal report binding.I am using C#.net and in my code i m using "dataset1 Ds" which retrieve all values but cant show that data into crystalreport viewer.
kindly find my code below......
<pre>
private void cmb_type_SelectedIndexChanged(object sender, EventArgs e)
{
if (Convert.ToInt32(cmb_type.SelectedIndex) == -1 && (Convert.ToString(cmb_type.SelectedValue) == "System.Data.DataRowView"))
{
return;
}
CrystalReport1 objRpt;
objRpt = new CrystalReport1();
String ConnStr = "Data Source=SHREE\\SQLEXPRESS;Initial Catalog=NandKumar;Integrated Security=True";
SqlConnection myConnection = new SqlConnection(ConnStr);
string Query1 = "Select * from " + cmb_type.Text ;
SqlDataAdapter adapter = new SqlDataAdapter(Query1, ConnStr);
DataSet1 Ds = new DataSet1();
adapter.Fill(Ds,"C"); // " + cmb_type.Text + "
if (Ds.Tables[0].Rows.Count == 0)
{
MessageBox.Show("No data Found", "Project Tracker Suite");
return;
}
// Upto this my code run- ok,i got problem from here...
objRpt.SetDataSource(Ds.Tables["C"].DefaultView);
CrystalDecisions.CrystalReports.Engine.TextObject root;
root = (CrystalDecisions.CrystalReports.Engine.TextObject)objRpt.ReportDefinition.ReportObjects["txtHeader"];
root.Text = "Sample Report With Parameter!!";
crystalReportViewer1.Visible = true;
crystalReportViewer1.ReportSource = objRpt;
}
}
|
|
|
|
|
hi friends
I want to know how to C# user interfaces invoke external tool kit like HTK 3.3 windows binary
please
|
|
|
|
|
Hi guys!
I'm writing a C# application that should use my cellphone's microphone as my pc microphone.
right now I'm using in the hand 32feet API to create the software but I'm not sure about in the hand's support for this one.
I'm looking for some example\ Explanation\ forum\ anything to start programming right(in C# - VERY IMPORTANT!).
just to mension - I've never did such thing and it's my first time programming for BT.
looking forward for your answers!
AMDO.
|
|
|
|
|
Ami Vaknin wrote: I've never did such thing and it's my first time programming for BT.
I've a feeling it could be your last too.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
yeah you must be right.
OK, now you can take your medicine.
good boy!....
go f*** yourself ya ben elef sharmutot.
|
|
|
|
|
When I drop an item into a ListView I get an out of memory exception... but... I have them on the same form.. within the same TabControl (different tabs though).
Basically I am saving the file... if the item is to be sent to M&R then I set the MR column (BIT) to True, and if not, then False. This way I can tell which ListView the item should show up in... But I get an error on the drag and dropping to the second listview (the M&R one)
private void listViewFiles_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
{
newFile = new OpenFileDialog();
newFile.FileName = file;
SaveFileThread(file, newFile.SafeFileName, false);
newFile.Dispose();
}
bwLoadFiles.RunWorkerAsync();
}
private void lstMRFiles_DragDrop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
foreach (string file in files)
{
newFile = new OpenFileDialog();
newFile.FileName = file;
SaveFileThread(file, newFile.SafeFileName, true);
newFile.Dispose();
}
bwLoadFiles.RunWorkerAsync();
}
Here is what it is calling:
private void SaveFileThread(string Filename, string SafeFile, bool MR)
{
RegistryAccess reg = new RegistryAccess();
SqlConnection conn = new SqlConnection(reg.ReturnConnection);
SqlCommand cmd = new SqlCommand("SELECT * FROM Inventory_Files WHERE FilesID=@FilesID AND [Filename]=@Filename AND MR=@MR", conn);
try
{
cmd.Parameters.AddWithValue("@FilesID", txtTAG.Text);
cmd.Parameters.AddWithValue("@Filename", SafeFile);
cmd.Parameters.AddWithValue("@MR", MR);
conn.Open();
SqlDataReader myReader = cmd.ExecuteReader();
if (myReader.HasRows)
{
if (MR) Invoke(new FilesLabelDelegate(FilesLabel), new object[] { "Did not save. File already exist.", true });
else Invoke(new FilesLabelDelegate(FilesLabel), new object[] { "Did not save. File already exist.", false });
}
else
{
conn.Close();
FileStream fs = new FileStream(Filename, FileMode.Open, FileAccess.Read);
decimal Size = fs.Length;
byte[] buffer = new byte[fs.Length];
fs.Read(buffer, 0, (int)fs.Length);
fs.Close();
if (MR) Invoke(new FilesLabelDelegate(FilesLabel), new object[] { "Saving file.. Size: " + Math.Round((Size / 1024) / 1024, 2) + "MB", true });
else Invoke(new FilesLabelDelegate(FilesLabel), new object[] { "Saving file.. Size: " + Math.Round((Size / 1024) / 1024, 2) + "MB", false });
conn = new SqlConnection(reg.ReturnConnection);
cmd = new SqlCommand("INSERT INTO Inventory_Files (FilesID, Saved_File, Filename, File_Size, MR) VALUES (@FilesID, @File, @FileName, @Size, @MR)", conn);
cmd.Parameters.AddWithValue("@FilesID", txtTAG.Text);
cmd.Parameters.AddWithValue("@File", buffer);
cmd.Parameters.AddWithValue("@FileName", SafeFile);
cmd.Parameters.AddWithValue("@Size", Size);
cmd.Parameters.AddWithValue("@MR", MR);
conn.Open();
int Success = cmd.ExecuteNonQuery();
if (Success > 0)
{
if (MR) Invoke(new FilesLabelDelegate(FilesLabel), new object[] { "Saved file.", true });
else Invoke(new FilesLabelDelegate(FilesLabel), new object[] { "Saved file.", false });
}
}
}
catch (Exception ex) { new Errors(ex).ShowDialog(); }
finally { conn.Close(); }
}
|
|
|
|
|
I would suspect this line
Jacob Dixon wrote: byte[] buffer = new byte[fs.Length];
You're creating a (contiguous) byte array big enough to hold the contents of a file. Worse, you're doing it in parallel for multiple files. I can see how this can quickly blow up memory consumption.
Just to isolate the problem, does running SaveFileThread sequentially help?
|
|
|
|
|
ok so if I create the
byte[] buffer;
outside the try/catch/finally.. then in the try I can create the
buffer = new byte[fs.length];
then in the finally I can set:
byte[] = null;
IT only does one at a time.. waiting for this part to get done before moving to the next file..
I did get it working though.. I didn't set the ListView to AllowDrop... and since I had to entire form to AllowDrop to put an image into a picturebox it was capturing it there. Seems to be working fine now... but what i changed will help with memory since I'm setting it to null at the end?
|
|
|
|
|
Jacob Dixon wrote: but what i changed will help with memory since I'm setting it to null at the end?
No, it shouldn't make any difference. Even if you don't set it to null, the CLR and the GC know enough to figure out that the byte array has no references outside your method, and array will therefore get garbage collected.
If just one file gives you an OutOfMemoryException, you should try streaming the contents of the file i.e. loading smaller chunks repeatedly, rather than loading it in one big byte array. I don't know enough ADO.NET to figure out how to stream it to the database though.
|
|
|
|
|
Hi
I am currently working on a project that requires me to read excel files from an external application. I am using the ExcelReader library (Excel Reader[^])
This works fine for spreadsheets <10mb (Others have reported problems only from around 300mb. This might be due to my spreadsheets being heavily loaded with macros, but that is just a hunch).
So I need one of two things:
1. A different library, one that can open (large) workbooks, identify sheets and get specific cell values (in the correct format). Thats all
OR:
2. I need the ExcelReader library to be able to handle large files. (it is otherwise really handy, so if this can be done it would be great)
Here is a code snippet of the method where it bombs out
internal static Int32[] ReadArrayOfInt32(BinaryReader reader, int count)
{
Int32[] data = new Int32[count];
for (int i = 0; i < data.Length; i++)
{
data[i] = reader.ReadInt32(); //throws EndOfStream Exception
}
return data;
}
Anyone have any suggestions?
Thanks
|
|
|
|
|
So you solved this issue?
Luis Fernando Forero G.
|
|
|
|
|
Hi Luis
If I remember correctly I ended up using another library called Taramon.Exceller which is basically a wrapper class for Excel interop. I initially tried to avoid this because it requires reading the entire excel file into memory whereas the ExcelReader class streams the required data directly (and much quickly).
Karl
|
|
|
|
|
OK I had a problem reading a large excel document.
The problem: The problem was who I was doing it.
Firs I loaded the excel file to the data base and for each of this excel I was making a validation.
The solution:
First I loaded the excel to a dt this data table had 4 columns as Keys and my validations whore to this DT so the 15000 row wore loaded an calculated in almost 30 secs
Thanks any way
Luis Fernando Forero G.
|
|
|
|
|
hi friends
I want to know how to convert C source code into C# source code
please..
|
|
|
|
|
Easy... 3 Steps...
1. Learn C Programming langauge
2. Learn C# Programming language
3. Re-Write the C Source into C# source
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
|
There are converters which can reduce the amount of work required, but you must have a good knowledge of both C/C++ and C# to get the job done.
David Anton
http://www.tangiblesoftwaresolutions.com
Convert VB to C#, C++, or Java
Convert C# to VB, C++, or Java
Convert C++ to C#, VB, or Java
Convert Java to C#, C++, or VB
|
|
|
|
|
hello, I need to call an Oracle FUNCTION which returns a REF CURSOR - tutorial?
closest I found is this, which illustrate stored proc (not function) with CURSOR output param (and use of OracleParameter with type=OracleType.Cursor)
http://support.microsoft.com/kb/322160[^]
Thanks
dev
|
|
|
|
|
|
hi friends,
i am working on c# .net and i need video cutter in my project.my project in c# .net and window application so if any one hacund code for that then please reply me.
thanks
|
|
|
|
|
I also need video cutter in my project. my project in c# .net and window application. so if any one can help me regarding this issue.
please reply me.
thanks.
|
|
|
|
|
Hi all,
TO my .net setup project i want to add a launch condition for crystal report installation.
In my prerequisities i selected Crystal reports fro basic visual studio 2008 (x64, x86)
in my debug folder i got those respective crystalreport10_5 folder after successful build.
i got CRRedist2008_x64.msi,CRRedist2008_x86.msi
i want to install CRRedist2008_x86.msi so in my Installurl i specified CRRedist2008_x86.msi's path.
but it is not installing, in installing window a message gathering information came and after some time it is closing.
so am trying to install CRRedist2005_x86.msi
but when am trying to install my setup project it always going to that crystal report launch condition though i installed CRRedist2005_x86.msi.
in my launch condition i gave properties as
Name : CrystalReport
Condition: CrystalReport
InstallUrl : CrystalReports10_5\CRRedist2005_x86.msi
Message: Do you want to install crystal Reports?
please provide launch condition to install crystal reports.
and why it is asking every time crystal report installation?
so that am not able to proceed further to install my application.
please help me out.
Thanks In Advance
|
|
|
|
|
Hdey pls let me know the answer if you will get the answer of your solution...
As i m also facing the same problem so..
pls reply earlyiest...
|
|
|
|
|
No dude, not yet
still am researching
no one providing necessary things.
|
|
|
|