|
hello
i've solved the problem in another way.
string ConnectionString="Integrated Security=SSPI;"+"Initial Catalog=;"+"Data Source=.;";
thanks for your efforts.
however there is another problem.
an error occurs when i run the create database query that is
string sql="CREATE DATABASE my_db ON PRIMARY"
+"(Name=test_data, filename='C\\mysql\\mydb_data.mdf', size=3"
+"maxsize=5, filegrowth=10%)log on"
+"(name=mydb_log, filename='C\\mysql\\mydb_log.ldf', size=3"
+"maxsize=20, filegrowth=1)";
the error is
"invalid use of the option maxsize in the CREATE/ALTER DATABASE statement"
can u tell me what i'm doing wrong with the query??
SAIRA
|
|
|
|
|
what is the most important factor to consider when overloading and overriding in c#?
|
|
|
|
|
When overloading methods, one thing to keep in mind is consistency of the API.
For example, suppose we have a method DoSomething() that ultimately requires an integer parameter and, optionally, string and boolean parameters. One way we could do this is the following:
void DoSomething(int required1);
void DoSomething(string option1, int required1);
void DoSomething(bool option2, string option1, int required1);
While this technically works, it's not a consistent API. How often are users going to have to consult their documentation to remember the order in which parameters are expected? Even worse, imagine that your optional parameters are of the same type. How easy would it be then to accidentally swap arguments passed to the method? Yes, Intellisense helps, but it's not a substitute for a simple API and, besides, not everyone uses Visual Studio.
Consistency further applies to the default values of those optional parameters. In general, "missing" parameters should have the same default value in each overloaded method.
When overriding methods, an important thing to keep in mind is maintaining the semantics of the base class method. That is, when a base class marks a method as virtual it expects that method to behave within certain constraints, despite the fact that the derived class can theoretically do whatever it likes within that method. For example, in a file stream hierarchy it might be that the ReadByte() method throw an exception if called before the Open() method. For a Windows Forms control it might be that the overridden OnClicked() method in the derived class must call the base class method (in order for the Clicked event to be fired).
For the developer of the API, maintaining semantics means documenting, in detail, the expectations of derived classes with respect to overriding methods. For the user of the API, it means ensuring derived classes meet those expectations.
-Phil
|
|
|
|
|
Stuck on your test?
---
b { font-weight: normal; }
|
|
|
|
|
Can somebody translate this vb.net code to its c# equivalent.
Public Class ColorRange
Private _high As Color = Nothing
Private _low As Color = Nothing
Public Property Low() As Color
Get
Return _low
End Get
Set(ByVal Value As Color)
_low = Value
End Set
End Property
Public Property High() As Color
Get
Return _high
End Get
Set(ByVal Value As Color)
_high = Value
End Set
End Property
Public Sub New()
End Sub
Public Sub New(ByVal low As Color, ByVal high As Color)
_low = low
_high = high
End Sub
Public Shadows Function ToString() As String
Return String.Format("{0}, {1}", _low, _high)
End Function
End Class
|
|
|
|
|
|
|
I've never worked with VB.NET but after a quick glance at the code I think I could easily translate this within a few minutes. So why don't you feel able to do this? Don't be that lazy!
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
public class ColorRange<br />
{<br />
private Color _high = Color.Empty;<br />
private Color _low = Color.Empty;<br />
<br />
public Color Low<br />
{<br />
get { return low; }<br />
set { _low = value; }<br />
}<br />
<br />
public Color High<br />
{<br />
get { return high; }<br />
set { _high = value; }<br />
}<br />
<br />
public void New()<br />
{<br />
}<br />
<br />
public void New(Color low, Color high)<br />
{<br />
_low = low;<br />
_high = high;<br />
}<br />
<br />
public override string ToString()<br />
{<br />
return String.Formt("{0},{1}",_low,_high);<br />
}<br />
}
By the way I don't even know VB but figured the C# code out easily. So you could do it. Don't be lazy and give a try next time
.:: Something is Wrong ::.
|
|
|
|
|
thanks guys. I just started using c# from vb6. I have tried to convert it already. i just want to double check it if what i have done was right
thanks
|
|
|
|
|
Well, i have created a localized version of the well known "DescriptionAttribute" attribute that derived from System.ComponentModel.DescriptionAttribue. This attribute loads the description from the resource file (you may see the SRDescriptionAttribute code in Reflector). However, when i switch a language at runtime - the old description still are shown and only descriptions that i access for the first time use the new language.
Unfortunately the "public override string Description" property is not even executed when an already loaded description is accessed again.
Any solution about how to make the system get the description again BUT NOT from the cache?
Thanks in advanced, ilan!
|
|
|
|
|
I have an app that launches another app. I dont want to return out of my function until the second app has exited. So Im using a while loop. But the first application needs repainting if you move the second app around on the screen. When I call invalidate in each pass it cleans up the garbage but does not draw controls. I see place holders of where buttons and other controls should be.
<br />
ProcessStartInfo startInfo = new ProcessStartInfo();<br />
startInfo.FileName = "InstallIDS.exe";<br />
Process process = Process.Start(startInfo);<br />
<br />
while (!process.HasExited)<br />
{<br />
Thread.Sleep(500);<br />
this.Invalidate(true);<br />
}<br />
|
|
|
|
|
You need to start the second process within a seperate thread for the first to remain responsive. I would question why you need to design it this way though. Are there other actions taht the user can be doing while the second process is running? Perhaps starting the second process in a hidden window would work for you.
only two letters away from being an asset
|
|
|
|
|
Thanks for the reply. I dont want the user to interact with the first process while the second process is running. I have a function that disables all the controls. So I think I will use that with a new thread.
I was hoping to let the parent form look responsive even though they couldnt do anything until the 2nd process was done. Its and application that launches installers and it also can delete files.. so I dont want them clicking on a button that could delete parts of something that their currently installing..
|
|
|
|
|
hey guys - i need a wee bit of help here
i need to write an application that sits in the system tray. the application monitor a given application by passing it a handle to it. The application must then "look" for any Edit fields and check for a postcode. if it finds a valid postcode the application must then attempt to "auto fill" the other applications input boxes in?
Im guessing im going to need to do some Win32 Introp programming here....
can anyone point me in the right direction?
|
|
|
|
|
Couldn't figure out what you want. Maybe you can clarify the question a bit?
Best,
Jun
|
|
|
|
|
i have a big problem ! when i change anything in my code project this error is appear :
""Unable to copy file "obj\Debug\Charge1.exe" to "bin\Debug\Charge1.exe". The process cannot access the file 'bin\Debug\Charge1.exe' because it is being used by another process.""
but if i don't change anything it isn't appear, do anybody know how can i fix this error?
|
|
|
|
|
Hello
This error appears when you try to rebuild your project while it's still runing. Close your application if you were running it. If not then you'd might need to rebbot and then rebuild again.
If this happens all the time, this means that you're application doesn't close when you close it. Maybe some thread is still alive and you didn't abort it. Otherwise if you try to build while the exe file is running, this is normal.
Regards
|
|
|
|
|
hello maryam, i think you dont have write permission on the drive you're trying to compile on "creating your .exe file" try to delete "Charge1.exe" from debug folders "you dont get a problem when you run it without changing the source code cuz you're running the compiled executable file!" to clean previous objects, try Build > Clean Solution, Build > Build Solution
good luck maryam
|
|
|
|
|
Hello everyone!
Back to C#, I don't wanna forget the language...
Hey, anyways, the last time I used it I was in VS 2003, now I'm in 2005... I know 2005 uses .NET 2.0, but not many people have that, so how can I make it use 1.0 or 1.1? Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
|
Hello Everyone..
I have a question I trust someone out there has an answer to.
I have a simple parent-child relationship in a DB. I wish to display the parent-child relationship in a C# / Winforms DataGrid WITHOUT the need to have the user click the hyperlink to display the child records... is it possible?
my current code displays :-
+ Parent Record
- <Relationship_name_hyperlink>
+ Parent Record
And only when the use clicks the hyperlink do the child records get displayed, additionally the parent records are removed.
I'd like to end up with a DataGrid that looks like this....
+ Parent Record
- Child record
- Child record
+ Parent Record
+ Parent record
oh, one other thing... does the DataGridView support 1-to-Many rel. in the same way as the DataGrid? It doesn't appear to!
Any information would be gratefully appreciated.
Many Thanks
Nigel.
-- modified at 1:56 Saturday 2nd September, 2006
|
|
|
|
|
Hi, I've posted this issue I am having in other forums but not getting help. Hope someone here can help out.
I have datagridview with unbounded checkboxes and data bounded textbox in one tab of a tab control. In another tab of the tab control I have a text box. Both the datagridview and the text box are using the same bindingsource.
I have a logic that unchecks the other unbonded checkboxes in the datagridview's CellValueChanged event when a different checkbox is selected. I used the CurrentCellDirtyStateChanged event to trigger the CellValueChanged event so the checkbox updating happends immediately.
The problem is, when the CurrentCellDirtyStateChanged fires, the text box on the other tab loose the value it holds. I am suspecting that it has something to do with the bindingsource being shared but don't know how to prevent that from happening.
Please help.
Thanks,
Rick..
|
|
|
|
|
I am toying around with an application that will be a Browser Helper Object (BHO) and also needs to react to the download event either by clicking a file to download or when they hit 'Save File As' command.
I am not exactly sure when to call the Interface, or even check if the event is a download event or not.
Anyone ever work with this interface before? This BHO will act similar to a Download Manager, I need to listen to the same events that a Download Manager would. Hope that makes sense.
Thanks for the time.
Steve Welborn
Software Engineer
BitWise Solutions
|
|
|
|
|
How much memory is available to a C# application?
Is there any such thing as needing to specify stack size in a C# build?
Thanks for any information or pointers to anything I can read on the subject.
|
|
|
|