|
It's normal, you may use a connection pool in order to avoid problems of connection.
myConnection.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=MyDatabase;server=MyServer;Connect Timeout=30";
The value is expressed in seconds:
Connect Timeout=30
|
|
|
|
|
That's kind of annoying. I've noticed these types of subtleties even when using standard MS tools like SSMS. My first reaction when something fails is to change some variable of the experiment before trying again, but with SQL Server, a lot of times, you just need to act like a crazy person and try the EXACT same thing expecting different results.
Thanks for your tip, I had managed to workaround the issue, but I might implement this suggestion as well.
|
|
|
|
|
greetings,
for the first time ever im investigating RichTextBox control in C# windows forms. i know i need this control in my app as textBox is to simple for my needs.
i have the followig code:
<br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Linq;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
<br />
namespace _19_richtextbox<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void richTextBoxHome_KeyDown(object sender, KeyEventArgs e)<br />
{<br />
if (e.KeyValue == (char)(Keys.Return))<br />
{<br />
richTextBoxChat.AppendText("Home:" + richTextBoxHome.Text + "\n");<br />
richTextBoxHome.Clear();<br />
}<br />
}<br />
<br />
}<br />
}<br />
for the moment i just want whatever is typed in one richtextbox to be displayed on the other richtextbox on hitting return.
the issue is everytime i hit return the data is being transfered to the other control but the first control is left with a carriage return before the cursor. this happens everytime i hit return.
how do i make it stop doing this?
both the controls accept multiline input.
please advise if i need to provide more info.
thank you for your time.
|
|
|
|
|
If you handle the return key and don't tell the OS you have done it, it passes it through to the default handler afterwards. Add "e.Handled = true;" to your code, all will be fine.
[edit]I can't spell "the" correctly - fixed.[/edit]
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
thank you for your response. it has solved my problem.
may i introduce you to my new situation?
i would like a way to make the "Home:" part in bold.
i have found very little info on this on my searches. the following are the only actual code that i could understand.
rtb1.Rtf = @"{\rtf1\ansi {\b hello} {\i World}}" ;
richTextBox1.Rtf = @"{\rtf1\ansi This is in \b bold\b0.}";
-----------
im not sure how to proceed with this info. i just want the richtextbox to display "Home:" and "Away:" in bold and be able to handle URLs in text.
please advise what should i specify when searching this potic on google or any reference your could think of would be of great help.
|
|
|
|
|
You seem to have most of what you need there already, but have a look at this[^] - it's in VB, but it's pretty clear.
Just think of rtf as an unreadable HTML file and you are just about there!
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
|
Hi
Am i ask a hard question about 4hours ago.
|
|
|
|
|
Your question is indeed tough. You have to wait patiently for an answer by somebody who knows the answer.
|
|
|
|
|
The reason you did not get an answer is because
a) It was a repost.
b) Your original was replied to, and you reposted last time
http://www.codeproject.com/Messages/3302834/Re-backup-database.aspx[^]
c) There are many examples on CP about to achieve what you want to achieve.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
My question was changed.
I asked that how can i backup from database.
I got my answer and check it when my database attach to microsoft sql.
but it is necessary for me to use SQLEXPRESS and that way doesn't work when i add my database to SQLEXPRESS and detach from microsoft sql.
I explain more about 4 hours ago.
If somebody know the answer please help me.
|
|
|
|
|
Does shouting and hassling people work in your company? Because in all the ones I've worked in, it just gets peoples backs up, and (certainly with me) reduces the amount of help given to the minimum they can get away with. Just thought I'd mention it...
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
please !
I don't think that i'm shouting or... .
I thought that i used wrong sentence or wrong structure because my first language is not english.
but if i told in bad way , i'm sorry.
|
|
|
|
|
using UPPER-CASE is equivalent to shouting.
|
|
|
|
|
REALLY? I WAS WONDERING WHY MY FRIENDS WENT DEAF WHEN I TURNED MY SCREEN-READER ON
[edit] Never mind, that sounded funnier in my mind.
modified on Monday, December 14, 2009 3:58 PM
|
|
|
|
|
|
Hello,
I'd like to create an array, and have it contain two items (two-dimensional) of two different types.
I believe the best way to do this is create my own type, however, I'm unsure how to handle the need for an array.
For instance, I want to create something that will take in:
SnapShot[i] = ( DateTime DateTime.Now, Int Size );
How can this be done?
Thanks,
Matt
|
|
|
|
|
Why not use a Dictionary?[^]
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Thanks!
This will work for two items.
What can I do if I want to store more items?
Thanks,
Matt
|
|
|
|
|
Then I would create a class to hold the info, and either use a Dictionary or hold it in a List<T>. You get the flexibility of the array, but without the need to specify the initial size .
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
I'd suggest creating a SnapShotInformation class with Date and Size properties.
You can then maintain a List<SnapShotInformation> . This has the advantage of being more maintainable and the size of the list is dynamic (ie you can add more items to is and it will resize).
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
why Class? Shouldn't struct be enough?
I Would use struct instead class. Because you do not need to hold any Function only data
|
|
|
|
|
Saksida Bojan wrote: I Would use struct instead class. Because you do not need to hold any Function only data
It is correct in C++ but not in C#. A struct in C++ is mainly used for POD types and in C#, you hardly write structs. You write it only when you need value semantics or you need to communicate with legacy APIs.
Best wishes,
Navaneeth
|
|
|
|
|
Is there performance drop? I use a lot of Struct in some of mine programs when I needed to hold a lot of Data structure within array (Not using PInvoke or accessing COM object). Is it better to use struct or class?
|
|
|
|
|
You might, under certain circumstances use more memory.
See
http://msdn.microsoft.com/en-us/library/ah19swz4(VS.71).aspx[^]
The things to note are (Quotes directly from above):
1) Struct are value types. Classes are reference types.
2) Structs have no inheritence (other than object).
3) "The struct type is suitable for representing lightweight objects such as Point [e.g. a Cartesian Co-ordinate]"
4) "Unless you need reference type semantics, a class that is smaller than 16 bytes may be more efficiently handled by the system as a struct."
C# is very different to c++ in this matter, I've been developing C# for about 8 years now, and have never needed a struct (though I have used them from 3rd party stuff).
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|