|
There is no Type called SqlTypes in the BCL. Do you mean the SqlType enumeration? You should use this when using parameterized queries and adding DataColumn s to ensure that data is represented correctly, as well as for design-time purposes and using classes like the SqlCommandBuilder . This helps determine what type of data is represented.
Imagine if all properties on every class were simply defined as object . How do you know what type of data to assign to a property in such a case?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
I think he is referring to the various struct s defined in the System.Data.SqlTypes namespace.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Perhaps, but that's why one should be a little more descriptive.
To the original poster, the documentation for the System.Data.SqlTypes (if that is, in fact, what you meant) explains it quite clearly:The System.Data.SqlTypes namespace provides classes for native data types within SQL Server. These classes provide a safer, faster alternative to other data types. Using the classes in this namespace helps prevent type conversion errors caused in situations where loss of precision could occur. Because other data types are converted to and from SqlTypes behind the scenes, explicitly creating and using objects within this namespace results in faster code as well.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Hi...
Can anyone tell me how to take a screenshot when the user press on a button?
I have no idea how to do this!
I does not know what to seach after at msdn!
Can anyone help me please?
|
|
|
|
|
|
Funny signature. Reminds me of the "Kluge Antworten auf dumme Fragen" from Al Jaffee in the MAD magazine of the 1980s
--
Affordable Windows-based CMS: www.zeta-producer.com
|
|
|
|
|
How can I find out what network cards are installed on my computer at run-time? Based off this information I want to find out additional information about each connection settings.
Thanks,
Einar
|
|
|
|
|
Windows Management Interfaces (WMI) is your answer, and can be queried using the System.Management classes. Specifically, the CIMv2 class (not a .NET class) Win32_NetworkAdapter is what you want to enumerate and query. To do that, you use a ManagementObjectSearcher :
using System;
using System.Management;
class Test
{
static void Main()
{
ManagementObjectSearcher searcher = new ManagementObjectSearcher(
"select * from Win32_NetworkAdapter");
foreach (ManagementObject nic in searcher.Get())
{
Console.WriteLine("Name: " + nic["Name"]);
Console.WriteLine("Network connection ID: " +
nic["NetConnectionID"]);
Console.WriteLine("Status: " + nic["NetConnectionStatus"]);
Console.WriteLine();
}
}
} You can install the Management Classes and Events add-in for either VS.NET 2002 or 2003 from http://msdn.microsoft.com[^] and actually create typed classes for whatever WMI classes you want, too.
For more information, search for "WMI" by clicking "Search comments". I've talked about this topic quite a bit and have given links to much more information over the course of the last couple years.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
Thank you very much for your reply. You put me on the right track in the right direction. However I have some additional questions.
Using the code you supplied I got a lot of "network cards" that I didn't know I had. I guess I could narrow my search down with a WHERE clause in the SELECT statement.
Do you know where I can find additional information about the information contained in these tables and the names of these tables?
Sincerely,
Einar
|
|
|
|
|
|
I've been charged with working on the help system for an application; right now we can associate keywords with controls, and the help system is basically a wrapper around the HelpProvider class. This kind of help requires that I manually go through every control that needs help (usually our various dialogs and large forms).
What I was wondering, is whether there is some property in the designer for the help keyword? If not, can the MS people around here tell me whether this is planned for Whidbey?
Also, has anyone tried replacing this manual help keyword specification with a system based on reflection? I was thinking we might try something where there is a base "helpable control" where when it is initialized it automatically registers a keyword based on its name with the HelpProvider. If you have done something like this before, could you give any tips or hints? Thanks.
|
|
|
|
|
The HelpProvider is an IExtender interfaces that "adds" a property to your controls. This value is actually persisted along with the Control (if you write your own IExtender component, you're responsible for persisting this map). Work with the HelpProvider and you shouldn't have any problems.
If that doesn't work, the designer always writes a values to the Control.Name property, which you could use as a keyword. If you support nesting of container controls that contain the same names, do something similar to ASP.NET and built a delimited name that resolve the child, like "Parent1_Parent2_Control1" (this is what the INamingContainer marker interface for ASP.NET is for).
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|
|
if my application has been teminated form Windows task Manager or from debug. Can i do any clean up work for my application before really shut it down?
|
|
|
|
|
|
Hi I want to make a toolbar for internet explorer using C# but there doesnt seem to be any information on how its done....
I don't know what I'm talking about
|
|
|
|
|
|
Hi,
I need to limit the number of instances running of my C# .NET Windows Application to one. Unfortunatly I don't know of any proper ways of doing so at the moment. Have any of you had any experiences or ideas about instance control of Windows Applications in C#?!
Thank you very much for your help!
|
|
|
|
|
A search of CodeProject and/or Google will yield a good selection of results. For what its worth, I'm currently using a modified version of Michael Potter's Single Process Instance Object[^] article.
Hope that helps.
--Jesse
|
|
|
|
|
Hi,
I need to represent a table (rows and columns) of a "Cell" class. I would like to be able to do the following on an instance of my CustomTable class:
table.Rows[2][6] - and get a specific Cell
table.Cols[6][2] - and get that same Cell out
So - I need a two dimensional collection of Cell-objects. And a way of adding properties to the table class to look in that two dimensional collection. If we look at the Rows property, it could be made like this:
public RowCollection Rows<br />
{<br />
get { return m_rows;}<br />
}
- where the RowCollection e.g. inherits from System.Collections.CollectionBase and implements the index-operator [] in order to get Row class instances out. These, in turn, must either be a collection of cell objects or have a .Items property which is a cellcollection (this would change the notation from table.Rows[2][6] to table.Rows[2].Items[6]).
However - making this work with the table.Cols[6][2] indexing as well requires that the table class has a m_rows collection of rows and a m_cols collection of columns - that both look into the same datasource - some sort of a two dimensional collection to represent the cells. I can't really think of a "sleek" way to implement this - I keep ending up with loads of collections and I have this thought nagging in the back of my head... This must have been done around a thousand times before
The main argument for having this as collections is that I need dynamic resizing at some point in time. And I feel a need for having a Row and Column class to hold some specific information for rows and columns - but if the Row class is just a Cell collection, it isn't really obvious to add properties to that class that are specific for the Row (the column, respectively).
Does anybody have any ideas or thoughts on this ? Of course, I'm probably just missing something really obvious here...
Anyone ?
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
Thinking off the top of my head here..
C# supports proper multi-dimensional arrays
Cell[,] mydata = new Cell[width,height]
or am I mis understanding your problem?
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
No, you're completely right
The problem with arrays is that they cannot be dynamically re-sized - and I need that. Anyway, I've been working on a solution where the table holds data in a System.Data.DataTable, and .Rows and .Columns properties access this datastorage.
Actually - I think that I need a simpler version of a DataTable which is less database-oriented and strongly typed to my Cell class. Any great ideas ?
Do you know why it's important to make fast decisions? Because you give yourself more time to correct your mistakes, when you find out that you made the wrong one. Chris Meech on deciding whether to go to his daughters graduation or a Neil Young concert
|
|
|
|
|
Hmm.. still bouncing ideas at random, you could probably make an ArrayList of ArrayLists, to give you a two dimensional dynamically re-sizable array. (ArrayList can store anything as an Object, which should basically be any C# class)
--
Help me! I'm turning into a grapefruit!
Phoenix Paint - back from DPaint's ashes!
|
|
|
|
|
I have a form with three constructors each with a different signiture.
i.e.
public Form_1() ...
public Form_1(string Name) ...
public Form_1(string Name, int Number) ...
How can i call the first constructor from the second and call the second from the third?
At the minute I have to copy the common code into functions and call the functions but would prefer to call the constructors as i used to do in VB.Net.
Thanks
|
|
|
|
|
Use the 'this' keyword like this
<br />
public Form_1() : this(null)<br />
{<br />
}<br />
public Form_1(string Name) : this(Name, 0)<br />
{<br />
}<br />
public Form_1(string Name, int Number)<br />
{<br />
}<br />
|
|
|
|
|
You've generated an extra call for no good reason. A better example would be:
public Form1() : this(null, 0)
{
}
public Form1(string name) : this(name, 0)
{
}
public Form1(string name, int number)
{
} Why generate an extra call on the stack just to "redirect" to another method?
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|