Without trying to execute the code, did you add parenthesis to ToString
method: x.ToString()
?
Uri
Without trying to execute the code, did you add parenthesis to ToString
method: x.ToString()
?
Uri
ParseCommand
is a static method. You cannot access non static methods / members from the static one.
Uri
C# and Java languages don't support multiple inheritance because of the diamond problem[^]. Here is the short summary:
The diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?
Uri
It seems to me that your desired result is to be interrupted once the input is received. Interruption by definition means context-switching (threads). You can apply a different approach (which is not a good design), by checking a boolean variable in a while loop. As stated this isn't desired as: 1. You will waste the cpu cycles 2. You will have threads anyway 3. You will need to deal with the race condition by applying locks - as one thread will read the boolean whereas another thread will write.
Uri
The best way is to wait on AutoResetEvent
or ManualResetEvent
and once the input is constructed, to signal those events
Uri
if it's SQL Server you can use: select table_name from information_schema.tables
if it's Oracle you can use the meta data views, like: select * from user_tables;
-- modified at 14:16 Monday 15th January, 2007
Uri
Hi, Add the "CompareTo" only to the Race class. Declare it as a virtual method (Just add the virtual keyword to its declaration). Provide an overrding to the "CompareTo" method in the RunningRace class. public class Race : IComparable { ... public virtual int CompareTo(object obj){...} ... } public class RunningRace : Race { ... public override int CompareTo(object obj){...} ... }
Uri
Hi, It seems that you are using named instance. In such a case you should check what is the port of that named instance in order to point your connection string correctly. For example, if your port number is 1550 you should specify the connection string as follows: Network Library=dbmssocn;Data Source=127.0.0.1,1550;...
Hope it helps,
Uri
Hi, There is not such a keyword in Sql Server. (There is one in Oracle, but it's a bad practice to use it in such a case) What you should do is to use a primary key in the INCOMETABLE table. UPDATE INCOMETABLE SET NAME ='PETER',AGE=30 WHERE EMPLOYEEID = 10
Uri
You can use either: System.Collections.Specialized.StringCollection
Uri
Hi, 1. The cleanest way to do it in my opinion is to use SPs. The SP will test using sql whether the DateTime is NULL
and if so won't insert it. ... SqlCommand insertCommand = new SqlCommand(...); insertCommand.CommandType = CommandType.StoredProcedure; insertCommand.CommandText = "YourSPNameHere"; ...
2. It seems wrong but it's ok. if you read about nullVale
in urn:schemas-microsoft-com:xml-msprop
(with replacement value) you will find that it just provides a mean to access DBNull
cell without throwing an exception, but it doesn't assigns that default value to the DS's cell. Therefore this code just assigns that default value to the desired cell. 3. Yes, you are right. You can change the code I have provided to be: private void t_tRowChanged (object sender, TDS.tRowChangeEvent e) { if(e.Action == DataRowAction.Add) { e.Row.d = System.DateTime.Now; } }
or to use SP as I have stated early.
Uri
Actually this is a very good question. I have assumed that you used typed dataset in your code (that is bounded to the DataGridView). * The nature of the ADO.NET is a disconnected way of work. Therefore I thought first that we need to define the default property in the DS. When the value of a DateTime column in the DataGridView and the underline DS isn't supplied it is assigned with its default value. So I have tried to accomplish this solution by defining a default value for the DateTime column in the DS's schema. After reading W3C and MSDN definitions of the DateTime constants I have added the following to the schema: default="2006-01-01T00:00:00"
but surprise, surprise: I have got the following statement (which actually states that the DS cannot be generated): "Failed to generate code. Invalid Primitive Type: System.DateTime. Only CLS compliant primitive types can be used. Consider using CodeObjectCreateExpression." Somehow it seems to be a bug, or maybe the DateTime type should be declared different in the schema when using defaults ??? (Does anybody know something about it ???) After searching the web a while I have found that urn:schemas-microsoft-com:xml-msprop
can be used. In nutshell it can be used to access the DS's columns that are DBNull
. So this is how the schema looks like now:
<xs:schema
...
xmlns:codegen="urn:schemas-microsoft-com:xml-msprop"
...
...
<xs:element name="d" type="xs:dateTime" codegen:nullValue="2006-01-01T00:00:00" minOccurs="0" />
...
But this isn't the end! In order to actually pass the default value to the DB we should assign this value to the desired row by providing the RowChanged
event, like follows: ... tds.t.tRowChanged += new tRowChangeEventHandler(t_tRowChanged); ... private void t_tRowChanged (object sender, TDS.tRowChangeEvent e) { if(e.Action == DataRowAction.Add) { e.Row.d = e.Row.d; } }
Brrrr... this is a very ugly solution. * Another way to solve this problem is to avoid to insert values that are NULL
s (or DBNull
s) i.e. when the values are nulls generate insert sql statement that just omits those values. When omiting the null values the default values of the DB will be applied.
Uri
Yes :) Just remove the ;? from the regex expression i.e. use the following expression: "(?>\w|\d)+"
. Hope it helps...
Hi, * use the following expr. @"(?>\w|\d)+;?)"
* use the Matches
method and not the Match
method as follows: ArrayList Numbers = new ArrayList(); Regex regex = new Regex(@"(?>\w|\d)+;?"); // only for 3 like "Gerald; 0650123456; Mike" ;-(((( MatchCollection collection = regex.Matches("Gerald; 0650123456; Sabine; Spech; 06761233333"); foreach(Match m in collection) { Console.WriteLine("**" + m.Value); }
-- modified at 12:12 Saturday 27th August, 2005
Hi, Maybe I didn't understand the requirements of your regex, because the regex I have provided returns a valid value for exectly 3 words or digit sets seperated by a comma. Could you provide me with more info about the results you are expecting to have ?
* Operator equality in C# compares refs pointing while Equals compares values equality. BUT: * For strings Operator equality in C# performs value type equality meaning it actually compares the values in the addresses. (Partially it's due the fact that strings are immutable in C# and usually we want actually to compare the values and not the addresses of the instances). In C# Operator equality makes internal call to string.Equals (thus results in slightly poorer performance).
Try to use the following regex expression: Regex regex = new Regex(@"[\w\d ]+;[\w\d ]+;[\w\d ]+");
the expression stands for:
at least one word, digit or space followed by semicolon
and
at least one word, digit or space followed by semicolon
and
at least one word, digit or space.
Let me know if it's ok Uri
It's enough to use Connection.Close() method. About the locks, what kind of queries do you use?
DTS is a part of the SQL Server and it states for: Data Transformation Services. It is particularly handy when you want to perform a task of transferring a data from text files, excels or other databases. DTS will be significantly faster than other program under assumption that there is no special business logic for the data to be transferred (Conversion of data isn’t considered to be a special business logic and can be easily done by the DTS). Hope it helps,