|
Actually I have to make a crystal report which needs two table nothing is common in between these two tables.i tried all these suggestion in this section but not working...i already posted my code...
|
|
|
|
|
With SQL Server:
"SELECT * FROM Table1 ; SELECT * FROM Table2"
(Other database engines don't allow multiple statements in a command.)
|
|
|
|
|
closin a form in application hangs the application or closes the applcn
i m doin a mobile application how can i close the form in the middle of running when a condition is met
i want to navigate to another form when a condition is met
this.close() and this.dispose is not working.
if (str.Equals("stop"))
{
//form shud be closed and navigate to another form
}
This code was posted by me...
|
|
|
|
|
Hi all...
I'm writing a program that passes on an XML file and present it on a treeView.
For some reason the application preform the task vary slow: for a 440K XML file the application needs a full minute and a half to present the tree!!, now I have a good computer and other XML readers I use read the 440K file in a second, so it's probably something I do wrong, I just don't know what.
here is the function that passes on the XML file and adds tree nodes.
private void AddNodesToTree(XmlNode currentXMLNode, TreeNode currentTreeNode)
{
if (currentXMLNode.HasChildNodes == true)
{
XmlNodeList XMLChildNodeList = currentXMLNode.ChildNodes;
XmlNode XMLChildNode;
TreeNode TreeChildNode;
int NodeIndex = 0;
for (int i = 0; i < XMLChildNodeList.Count; i++)
{
if ((XMLChildNodeList.Item(i).GetType().ToString() != "System.Xml.XmlComment") &&
(XMLChildNodeList.Item(i).GetType().ToString() != "System.Xml.XmlText"))
{
XMLChildNode = currentXMLNode.ChildNodes[i];
if (XMLChildNode.Attributes.Count != 0)
{
currentTreeNode.Nodes.Add(XMLChildNode.Attributes.Item(0).InnerText);
}
else
{
currentTreeNode.Nodes.Add(XMLChildNode.Name);
}
TreeChildNode = currentTreeNode.Nodes[NodeIndex];
NodeIndex++;
AddNodesToTree(XMLChildNode, TreeChildNode);
}
}
}
else
{
currentTreeNode.Text = (currentXMLNode.OuterXml).Trim();
}
}
Thanks, Jimmy
|
|
|
|
|
Suspend updating the display, that is your big cost. Use SuspendLayout() before you start adding nodes and then ResumeLayout(true) at the end.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
): doesn't work... still it takes a lot of time.
I've added SuspendLayout() just before I call the AddNodesToTree() for the first time, ResumeLayout(true) after that.
maybe it is the treeView?
I'm using XmlDocument to read the file and XmlNode/List.
|
|
|
|
|
Check Piebald's comments and also move the SuspendLayout() and ResumeLayout(true) outside the loop. You are still refreshing the display for EVERY node you add.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
<code>SuspendLayout()</code> and ResumeLayout(true) are out of the loop.
|
|
|
|
|
Also, don't use XMLChildNodeList.Item(i).GetType().ToString() != "System.Xml.XmlComment" ; look into the is operator.
|
|
|
|
|
I commented the lines where I build the tree in the function, so now the function only travels in the file. Also when the function ends (completely) I pop up a Message Box, and it took exactly a second for the application to pop up the message, so it's probably the way I build the tree.
|
|
|
|
|
that is the way to go: split it up in smaller pieces, so you can see which one takes too much time.
alternatively, add logging code, where each message shows time in milliseconds, as with DateTime.Now.ToString("HH:mm:ss.fff")
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi all, still haven't find the downer...
but I encourage you all to try this tutorial, which is actually the base of my source code: How to populate a TreeView control with XML data
This is a Microsoft tutorial, really short and simple - just copy and paste. Try loading a large XML file (440K and above), if anyone has insights I would love to hear!
|
|
|
|
|
Hi,
Can any one suggest me how to convert HTML file to Excel and Pdf .
In C# Code only
I have html file i want 2 generate that file to Excel and PDF
|
|
|
|
|
|
Im writing a simple control to use in my app. It consists of a button with two labels on it, each displaying different data.
Heres my problem:
When I use the control in my app, I have to click twice on the labels to trigger the click event of the control while clicking on a part of the button with no label on it works correctly. I assume the way to handle this is to tie the labels click events to the controls click event. I have managed to setup properties correctly to alter label text and color and what not but how do I go about linking the click events"
Thanks,
Jon
|
|
|
|
|
I'm guessing then that the purpose of the two labels are to display some kind of relevant data that is refreshed upon clicking the button?
If that is the case, it might be considered a better UI strategy to have the two labels above the button rather than on it, and the button labeled "Refresh".
But if you are intent on keeping other controls on top of your button, then yes, you could simply have the label click handler and the button click handler each call the same code method.
|
|
|
|
|
Actually no, the data on the labels doesnt change once it is set. The button is for music, the top label is the song title and the bottom is the album name. When the user clicks anywhere on the button(including on the labels), the song should loaded into the queue to be played.
Problem is when the user clicks on a part of the button with a label, they have to click twice in order to trigger the load.
|
|
|
|
|
Actually no, the data on the labels doesn't change once it is set. The button is for music, the top label is the song title and the bottom is the album name. When the user clicks anywhere on the button(including on the labels), the song should loaded into the queue to be played.
Problem is when the user clicks on a part of the button with a label, they have to click twice in order to trigger the load.
|
|
|
|
|
Hi,
Just wondering...
I downloaded the MySQLConnection library for VS. I'm using the code below to try and connect to a MySQL database on my webpage.
It's not working though
Anyone tried doing this before?
<br />
<br />
string server = "Server=http://www.somepage.org.nz;Database=somedatabase;Uid=myusername;Pwd=mypassword";<br />
MySqlConnection con = null;<br />
try<br />
{<br />
con = new MySqlConnection(server);<br />
con.Open();<br />
this.label1.Text = con.State.ToString();<br />
}<br />
catch (Exception ex)<br />
{<br />
this.label1.Text = ex.Message;<br />
}<br />
Mark Brock
"We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
|
|
|
|
|
|
Hi,
1) First you need to add reference MySql.Data to your application.
2) Then //create a new mysqlconnection
MySqlConnection mycon = new MySqlConnection("datasource=localhost;username=root;password=pwd;database=project");
//create a mysql DataAdapter
MySqlDataAdapter myadp = new MySqlDataAdapter("select * from FAB", mycon);
//create a dataset
DataSet myds = new DataSet();
//now fill and bind the DataGrid
myadp.Fill(myds, "empinfo");
dataGridView1.DataSource = myds.Tables["empinfo"].DefaultView;
I have used with windows application. Try this.
Regards,
Subbu
|
|
|
|
|
MarkBrock wrote: string server = "Server=http://www.somepage.org.nz;
That's not going to work. You cannot access a database over the HTTP protocol.
Your corrected string should look more like:
Server=someSqlServer.somepage.org.nz;
But, that's not likely to work either. Either the MySQL server has to be exposed directly to the Internet (a REALLY STUPID thing to do), or that site has to expose some other method of interaction with the database, such as a Web Service.
|
|
|
|
|
Dave Kreskowiak wrote: ...exposed directly to the Internet (a REALLY STUPID thing to do)...
5.
|
|
|
|
|
Thought that might be the case, cheers Dave.
Mark Brock
"We're definitely not going to make a G or a PG version of this. It's not PillowfightCraft." -- Chris Metzen
|
|
|
|
|
i am reading a CSV file and getting error that file is in use. i am trying to read CSV file by ado.net and fill the dataset.
my code is as follows :-
---------------------------
DataTable dt = null;
bool flag;
DataSet objDS = new DataSet();
OdbcConnection mobjCon = null;
try
{
string mstrConnectionString = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" + Path.GetDirectoryName(strFilePath) + ";Extensions=asc,csv,tab,txt;Persist Security Info=False";
string strQuery;
mobjCon = new OdbcConnection(mstrConnectionString.Trim());
mobjCon.Open();
strQuery = "select * from [" + Path.GetFileName(strFilePath) + "]";
OdbcDataAdapter mobjAdapter = new OdbcDataAdapter(strQuery, mobjCon);
mobjAdapter.Fill(objDS, "phone");
CreateTableInDatabase(tableName);
using (SqlBulkCopy bc = new SqlBulkCopy(Business.ProgramConnections.OrcsConnectionString))
{
bc.DestinationTableName = tableName;
bc.WriteToServer(objDS.Tables["phone"]);
bc.Close();
flag = true;
}
if (flag)
{
mobjCon.Dispose();
FetchData(tableName);
}
}
catch (Exception objEx)
{
throw objEx;
}
finally
{
if (mobjCon.State == ConnectionState.Open)
{
mobjCon.Close();
}
}
in this above way i am trying to fill dataset with data from CSV file.
i am getting error because file is opened by another application.
i want that if the file is opened by another application inspite of i want to read this CSV file and populate my dataset. so please anybody rectify my code to read the locked CSV file and populate the dataset.
if possible give me a sample code by which i can read any locked CSV file, i mean in use CSV file and populate my dataset.please help me this is urgent.
Thanks in advance
tbhattacharjee
|
|
|
|