Yes it's possible: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_12_9ooj.asp[^] Alexandre Kojevnikov MCAD charter member Leuven, Belgium
Alexander Kojevnikov
Posts
-
Linking One Server To Another -
Detecting the Path. Please help!daljv wrote: You have learned twice Indeed :) Alexandre Kojevnikov MCAD charter member Leuven, Belgium
-
Detecting the Path. Please help!Replace
WindowsApplication7.Form1.resx
withWindowsApplication7.Form1.resources
. This should work. Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
Detecting the Path. Please help!I probably misunderstood your question. You will need:
System.Reflection
andSystem.IO
. Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
Detecting the Path. Please help!daljv wrote: What namespace will i add for this? Whichever you find appropriate. Just don't forget to update the parameter of
GetManifestResourceStream()
to"Namespace.Of.Form1.resx"
. Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
Detecting the Path. Please help!Form's .resx file is an embedded resource. This means you can access it as shown below:
Assembly assembly = Assembly.GetEntryAssembly();
Stream stream = assembly.GetManifestResourceStream(
"WindowsApplication1.Form1.resx");Alexandre Kojevnikov MCAD charter member Leuven, Belgium
-
Encoding user inputYou should avoid encoding user input into your SQL queries. This is a major security hole:
SELECT MyColumn FROM MyTable WHERE MyOtherColumn={1}
can becomeSELECT MyColumn FROM MyTable WHERE MyOtherColumn=0; DELETE FROM MyTable
A better solution is to use stored procedures and pass user input as their parameters. Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
howto search SQL ServerYou can also do this without SQL-DMO but in C++: http://sqldev.net/misc/ListSQLSvr.htm[^] Alexandre Kojevnikov MCAD charter member Leuven, Belgium
-
Hashtable problemMSDN - foreach: The foreach statement is used to iterate through the collection to get the desired information, but should not be used to change the contents of the collection to avoid unpredictable side effects. MSDN - Hashtable.Keys Property: The returned ICollection is not a static copy; instead, the ICollection refers back to the keys in the original Hashtable. Therefore, changes to the Hashtable continue to be reflected in the ICollection. An alternative approach could looke like this:
Hashtable ht = new Hashtable();
ht.Add("one", 1);
ht.Add("two", 2);
ht.Add("three", 3);
ht.Add("four", 4);ICollection keys = ht.Keys;
object[] copiedKeys = new object[keys.Count];
keys.CopyTo(copiedKeys, 0);
foreach(object key in copiedKeys)
{
ht[key] = "";
}Alexandre Kojevnikov MCAD charter member Leuven, Belgium
-
howto search SQL ServerYou can use
SQL-DMO
for this:Application.ListAvailableSQLServers()
Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
Using a C++ library in C#Yes you can use C++ functions from C# as long as they are exported from your C++ DLL. The function prototype in C# will look like this:
[DllImport("my.dll")]
public static extern int MyFunction(string param1, int param2);You can check this MSDN arcticle for details: Consuming Unmanaged DLL Functions[^] Alexandre Kojevnikov MCAD charter member Leuven, Belgium
-
get rows returned from data adapterUse
ds.Tables["MyTable"].Rows.Count
property to get the total number of rows inMyTable
DataTable. Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
com object, [out] params (pointers to values), C#The calling code should look like this:
int myValue;
myCOMObject.MyGetValue(out myValue);Alexandre Kojevnikov MCAD charter member Leuven, Belgium
-
com object, [out] params (pointers to values), C#After you add a reference to your COM dll you will see the IntelliSence info for its COM objects. Also, you could just go to the Object Browser and check how the syntax looks like. Your function will probably translate into this:
void myfunction(ref string stringvalue, ref int intvalue);
Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
About some syntaxAleon666 wrote: virtual void operator()(const char* string)=0; // call using operator This is an abstract virtual function. The class containing an abstract virtual function cannot be instantiated, and is intended to be a base class. Aleon666 wrote: template class TSpecificFunctor : public TFunctor I guess this should look like this:
template<class TClass> class TSpecificFunctor : public TFunctor
This is a declaration of a template class. I think you better read on templates in MSDN. Aleon666 wrote: TSpecificFunctor specFuncA(&objA, TClassA::Display); I again guess it should be:TSpecificFunctor<TClassA> specFuncA(&objA, TClassA::Display);
This line creates an instance of TSpecificFunctor object, passing TClassA as a template argument, and (&objA, TClassA::Display) as constructor arguments. Aleon666 wrote: TFunctor** vTable = new TFunctor*[2]; This creates an array which contains two pointers toTFunctor
objects. This array is then initialized with two created functors:specFuncA
andspecFuncB
. HTH Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
About some syntaxIt's C++, not C#. You can read about functors here: http://www.codeproject.com/vcpp/stl/functor.asp[^] Alexandre Kojevnikov MCAD charter member Leuven, Belgium
-
How to get the columns except onePhilip Patrick wrote: you will still need to change your code Exactly. But if you don't use
SELECT *
you will get errors in your SQL query and will have one more possibility to think about consequences of column renaming and adapt the client code appropriately. WithSELECT *
you might forget about adapting the client code. And in many cases you won't even see compile-time errors. If you are just reordering columns, you won't have to change anything. Performance is also an important issue of course. Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
Fishy += opperatoreggie5 wrote: I don't understand what you want me to do with ....
this.timer2.Tick += new System.EventHandler(this.timer2_Tick);
Move it to the constructor, just afterInitializeComponent();
Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
How to get the columns except oneMike Dimmick wrote: How can I get the data of all columns except for ID column? Just want to add that it's a bad practice to use
SELECT *
. Think what will happen with your code if you rename some of your table columns or reorder them. Alexandre Kojevnikov MCAD charter member Leuven, Belgium -
What's wrong with Query String;Bo Hunter wrote: Will the IN operator work in Access? Yep, it will. Bo Hunter wrote: Does that also have to be exscaped in OleDbParameter Probably it has to be escaped. This won't hurt anyway ;) Alexandre Kojevnikov MCAD charter member Leuven, Belgium