|
Group by duration and use min(id) to get one of the records to keep, and use having to get the ones where count(*) > 1. Now join this result in a delete on the table, and specify the ones where id is different and duration is the same.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I have made a project in which i have generated a report with the help of data in the database. Now I need to print the report but I don't know how to include and print a *.doc extension file through the project.Please help me......
|
|
|
|
|
1. save your report from database in temporary file and give extension .doc i.e: c:\temp\abcd.doc
2. call ShellExecute with parameter 'print' instead of 'open' (please read documentation about calling winapi method)
requirement : ms word
hope it helps
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Hi,
you don't really need ShellExecute and WinApi; the Process class and ProcessStartInfo.Verb offer
the required functionality.
|
|
|
|
|
thanks fyi
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Heyho SeeSharp PPL,
I have a question, for status connection:
private void button2_Click(object sender, EventArgs e)<br />
{<br />
string MyConString = "SERVER=" + WheRe + ";DATABASE=" + dB + ";UID=" + aCC + ";PASSWORD=" + Pw + ";";<br />
MySqlConnection connection = new MySqlConnection(MyConString);<br />
<br />
if (connection.State == ConnectionState.Closed)<br />
{<br />
string code = "Connection failed!";<br />
}<br />
else<br />
{<br />
string code = "Connection successful!";<br />
}<br />
<br />
<br />
System.Windows.Forms.MessageBox.Show(this, code);<br />
connection.Close();<br />
this.Close();<br />
}
How can i make the if statement to work it does show me anny errors.. and it doesnt work like i want it todo..
Anny one? =)
|
|
|
|
|
Hi,
Can't see any call to Open method so the connection will not be established. Try adding it before investigating connection state.
Also keep in mind that a connection has several possible states.
Mika
|
|
|
|
|
use System.Data.OleDb.ConnectionState.State (while using ACCESS data base or use accordingly).
|
|
|
|
|
When you open the connection, it will throw an exception if the connection fails.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
im not sure but, im looking for a sample piece for the statement..
Can some give me a sample?
|
|
|
|
|
...
MySqlConnection connection = new MySqlConnection(MyConString);
try {
connection.Open();
System.Windows.Forms.MessageBox.Show(this, "Connection state is now " + connection.State);
connection.Close();
} catch (System.Exception exception) {
System.Windows.Forms.MessageBox.Show(this, "Connection failed:\n\n" + exception.Message);
} finally {
this.Close();
}
Was this what you were looking for?
Mika
|
|
|
|
|
Thanks Mika!
|
|
|
|
|
You're welcome.
|
|
|
|
|
Hi All,
Im using a string to select some rows from my datatable:
string expression;
expression = "Act = '001' ";
DataRow[] foundRowsq;
foundRowsq = dtPar.Select(expression);
Now how can i the not equal token in my expression? when i doe this im getting a error:
expression = "Act != '001' ";
So what should i use instead of != ?
Thanx.
|
|
|
|
|
Try <> instead of !=
Mika
|
|
|
|
|
Hi, I am developing a windows application that reads info from IIS such as names of websites hosted and so on. I need to read the physical local directory of the website to know where it is situated on the hard drive. I can see it in the properties window under home directory tab but I cannot read it using code. E.g. Default Website -> C:\inetpub\wwwroot
Thank you.
|
|
|
|
|
use ServerMapPath
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
Thank you. I will try
|
|
|
|
|
or use Request.ApplicationPath
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
Sorry but my application is windows not web.
Thanks.
|
|
|
|
|
For Each control In Me.Controls
MessageBox.Show(control.Name)
Next
How to do it in c#
Dabsukol
|
|
|
|
|
foreach(Control control in this.Controls)
{
MessageBox.Show(control.Name);
}
|
|
|
|
|
I have just created my first TCP client/server and it works fine. Because this is the only way i could figure out how to do it the client operates on a separate thread from the main program. I want to update a TextBox in the Windows Form from this separate thread.
I am getting strange behavior however: I set the TextBox.Text = "new text" + "\r\n" + TextBox.Text; This should add on the new text to what was already there, but instead the new text just replaces what was there. I have tried setting Control.CheckForIllegalCrossThreadCalls = false; and using an Invoke call to try and prevent illegal cross-threading, but neither solved this problem.
Thank you for your help ahead of time.
|
|
|
|
|
you cannot update a control from WindowsForm directly from another thread because windows form is run in separate thread, you have to invoke that control. I give this small sample but if this information not clear enough you have to search with key 'invoke windows form control'
in your form add this code
delegete void SetMyTextBoxCallback(string text);
public void SetMyTextBox(string text)
{
if (textBox1.InvokeRequired)
{
SetMyTextBoxCallback d = new SetMyTextBoxCallback(SetMyTextBox);
this.Invoke(d, new object[] {text});
}
else
{
textBox1.Text = text + Environment.NewLine + textBox1.Text;
Application.DoEvents();
}
}
then call SetMyTextBox method in where your code need to update text in textbox
hope it helps
dhaim
program is hobby that make some money as side effect
|
|
|
|
|
Thank you, but i have already tried this (and just to make sure I copied your example above almost verbatim). I am not getting an error. Instead the text is behaving strangely.
I do this:
textBox1.Text = text + Environment.NewLine + textBox1.Text;
And the textBox just sets itself to text instead of adding text to the beginning. It acts as if I had written:
textBox1.Text = text;
Strangely enough if I write:
textBox1.Text = textBox1.Text + Environment.NewLine + text;
//just switched around the order of the text
Then it writes this out correctly . Unfortunately this isn't what I want.
Is this a strange behavior caused by threading or something else? Any more help would be greatly appreciated.
|
|
|
|