|
This gets the best post of the day award hands down!
I can just see the Valley Girl SQL compiler error messages now:
line 1: "CREATE PROCEDURE"
compile error, expected token UMM, LIKE, or UHH
Sincerely,
Alexander Wiseman
|
|
|
|
|
Alexander Wiseman wrote: compile error, expected token UMM, LIKE, or UHH
Hilarious!
Josh, I think you should patent the name.
Logifusion[^]
|
|
|
|
|
I think your post should share the award.
Cheers,
Vikram.
"I am not Jesus and will never be. The fact is I was a piece of cr*p till I found Him." - Paul Selormey.
|
|
|
|
|
line 1: "CREATE PROCEDURE"
Ya know, there was this like compile error, and I kinda expected a token umm, like, UMM, LIKE, or UHH
I've seen better runs in my shorts! - Patches O'Houlihan
|
|
|
|
|
How about ...
Umm SELECT LIKE STUFF
FROM YOU KNOW LIKE DUH
WHERE THINGS ARE LIKE WHATEVER
ORDER BY DRIVETHROUGH, FRIESWITHTHAT = YES
|
|
|
|
|
No you can't do that. You would have to say where (field like '%list1%' or field like '%sdf%') but that would be inefficient anyway.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Select Field1,Field2,Field3 From TableName Where Field1 In(Select Field4 From Table2 Where Field4 Like '%Something%')
|
|
|
|
|
I mean be an idiot for asking this question too but is there a way to pass a class as a parameter of a method i.e.
I have a repeated block of code like this:
class pTermsEditor;
pTermsEditor = new class();
pnlViews.Controls.Add(pTermsEditor);
pTermsEditor.Dock = DockStyle.Fill;
This Block of code is repeated many times but the class type may and almose always does change, so I want to control it more by putting it into a method something like this:
myMethod(class)
{
class x;
x = new class();
//blah blah blah
}
Any help or even a better solution what be greatly appreciated
|
|
|
|
|
You can use the object type, and it is a valid question.
for example
<br />
myMethod(object obj)<br />
{<br />
if (obj.GetType() == typeof(classA))<br />
{<br />
ClassA objA;<br />
objA = (ClassA)obj;<br />
return;<br />
}<br />
if (obj.GetType() == typeof(classB))<br />
{<br />
ClassB objB;<br />
objB = (ClassB)obj;<br />
return;<br />
}<br />
<br />
}
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
-- modified at 14:58 Thursday 6th July, 2006
|
|
|
|
|
You can pass a Type object and then use Activator.CreateInstance to create an instance via the default (parameterless) constructor.
Or, if you're using .NET 2, you can make a generic method whose type parameter is the type that you want to create. Then just do T obj = new T(); where T is your type parameter name.
If all else fails, you can always do the magical type parameter dance and everything should work out fine.
:josh:
My WPF Blog[^]
|
|
|
|
|
That'll work, so long as you put a new() (that is, default constructor) constraint on the method:
void CreateNew<T>() where T : new()
{
T instance = new T();
...
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
That's cool. Thought it wasn't doable
Best,
Jun
|
|
|
|
|
C++/C# hasn't invented that feature yet
Best,
Jun
|
|
|
|
|
hi,
i'm using VS.NET 2003 and I would like to add some systemtray functionality to my C# application. The SystemTray icon should support the follwoing features:
1. Display Baloon Tooltips
2. Display a context menu when right clicked
3. Repsond to mouse events such as Click, DoubleClick etc.
...and other such suff
ANyone know a good class that would help me do this. I have a came across a few but each of them lack some or the other feature. I'm looking for a free one - don't wanna shell out a penny for this one. :->
|
|
|
|
|
NotifyIcon[^]
"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
|
|
|
|
|
cool, but i guess it doesnt support balloon tooltips.
|
|
|
|
|
From MSDN: "The Text property assigns ToolTip text."
"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
|
|
|
|
|
Greetings!
I was wondering if I could get some direction to get me started in implementing a "copy/paste" of the properties of a UserControl.
In my application, I have 10 instances of a particular UserControl. This UserControl has, say, 10 properties. I would like to be able to use the right-click menu that I have for this UserControl and be able to copy the "settings" of one instance to any other instance of the UserControl.
From what I've read on MSDN, I understand that I have to make the UserControl class Serializable and that the variables that I do not copied can be excluded using the [NonSerializable] attribute, thus so:
<br />
[Serializable]<br />
<br />
public class ctlMyControl : ctlBaseControl<br />
{<br />
int nNum1;
float fNum2;
<br />
[NonSerializable]<br />
float fNum3;
<br />
}
My question is how does one implement the actualy copy and paste?
What function(s) do I use to perform the copy and what function(s) do I use to paste?
Your help is appreciated!
Thanks!
-- modified at 13:39 Thursday 6th July, 2006
|
|
|
|
|
Well, I'm not sure about the right-click menu, but serializing is a trick you can use to copy a complex object. Mark the class as Serializable and then use the System.Runtime.Serialization.Formatters.Binary.BinaryFormatter . You binary serialize your object into a MemoryStream and then deserialize it into a new object. Voila - a copy of your original without having to hand-code all the copying.
Logifusion[^]
|
|
|
|
|
Hi Dustin,
Could you give me some example code or point me to some examples of how this could be done?
Thanks for your time!
|
|
|
|
|
Sure thing. I needed to be able to copy a CodeCompileUnit object. This represents an entire CodeDom graph which can get really huge. It's a Microsoft library, so I can't just edit the code myself, and digging through the entire graph to copy it would not only be tedious but potentially faulty. It's just not an option. Luckily, serialization is there:
private CodeCompileUnit CopyCcu(CodeCompileUnit ccu) {
try {
BinaryFormatter bf = new BinaryFormatter();
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, ccu);
ms.Position = 0L;
CodeCompileUnit newCcu = bf.Deserialize(ms) as CodeCompileUnit;
return newCcu;
}
catch (Exception exc) {
}
}
This is at least how you would get a copy of your UserControl . I'm lost on the whole right-click thing. Where are you doing that? In the Visual Studio designer?
Logifusion[^]
|
|
|
|
|
This is not exactly a C# question, but I'm not sure where else to ask it.
I have an Access database program I wrote some years earlier. I am porting it into C# and trying to import the data from the older database to a newer version of the same database. Some tables are not identical, so I am writing an import feature.
The problem I am having is when importing from a memo or text field where the data includes " or ' characters since these characters are needed outside the SQL statement to indicate a text import.
Example: "INSERT INTO [Table] ([Field1]) VALUES ('This is a 'very' large project.')
Thanks in advance for any help.
S Hurt
|
|
|
|
|
Stephen Hurt wrote: but I'm not sure where else to ask it.
Stephen Hurt wrote: "INSERT INTO [Table] ([Field1]) VALUES ('This is a 'very' large project.')
Well since that is a SQL statement I would think the SQL / ADO / ADO.NET forum might be helpful?
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
I think you just double up the single quotes:
Example: "INSERT INTO [Table] ([Field1]) VALUES ('This is a ''very'' large project.')
|
|
|
|
|
I have a command button that I basically want it to do one thing the first time, and something else on subsequent clicks.
I have a datagrid and the user clicks a button to add a line. The first time this happens, I need to go thru the BindData method to get everything initialized.
For subsequent clicks, I just want it to add the lines. I don't want to have to go through a postback, because I either end up with the first added line reset or I get the object reference not set to an instance error.
private void Button2_Click(object sender, System.EventArgs e)<br />
{ <br />
<br />
DataGridItemCollection items = dgParts.Items;<br />
int rows = items.Count;<br />
if (rows == 0)<br />
{<br />
BindData();<br />
DataTable dt = ds.Tables["Rest"];<br />
DataRow row;<br />
row = dt.NewRow(); <br />
strPartNumberInputReference = txtSearchPart.Text;<br />
row["PartNumber"] = strPartNumberInputReference; <br />
row["DrawingNumber"]=DBNull.Value;<br />
row["DrawingRevision"]=DBNull.Value;<br />
row["DwgPath"]=DBNull.Value;<br />
dt.Rows.Add(row); <br />
dt.AcceptChanges(); <br />
dgParts.DataSource=dt; <br />
dgParts.DataBind();<br />
}<br />
<br />
else<br />
{<br />
DataRow row;<br />
row = dt.NewRow(); <br />
strPartNumberInputReference = txtSearchPart.Text;<br />
row["PartNumber"] = strPartNumberInputReference; <br />
row["DrawingNumber"]=DBNull.Value;<br />
row["DrawingRevision"]=DBNull.Value;<br />
row["DwgPath"]=DBNull.Value;<br />
dt.Rows.Add(row); <br />
dt.AcceptChanges(); <br />
dgParts.DataSource=dt; <br />
dgParts.DataBind();<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
}
When I click the button the second time my row count does say it has one row and tries to run through the else statement, but I get the null error thing.
I've been stuck on this for several days so if someone has any idea of a solution you will be my hero!
|
|
|
|