Page 1 of 1

how to use a C#node to visit MySql database and operate it

Posted: 31 Jul 2013, 07:09
by zhaohuifu
hi,
I want to use a C# script node to do some operation with MySql database in ventuz ,
I found that "if I want to connect to MySql database with C#,I need to download a MySQL-connector-net-6.0.4-noinstall.rar,put it in the folder"project\bin",and import it in VS",(I do some test in VS).
if I do it in ventuz by C# script node,firstly I need to solve the problem that "import the mysql package ".
in the user manual, it said that "only .Net Assemblies which are registered in the Global Assembly Cache(GAC) can be added to the GAC Assemblies list". I wonder that whether the MySql.Data.dll I need is the kind of the ".Net Assemblies".And how to registered in the Global Assembly Cache.
now ,this two problem make me confused .
have anyone met this problem
just help me .


best regard!.

Re: how to use a C#node to visit MySql database and operate

Posted: 31 Jul 2013, 20:27
by SamTheSwede
I don't know much about MySql, but if you have a dll that you reference in VS, just add that dll to the GAC using gacview.exe (just google it, you'll find it) and you will be able to use it in your c# scripts in Ventuz as well.

// Sam

Re: how to use a C#node to visit MySql database and operate

Posted: 01 Aug 2013, 09:53
by zhaohuifu
thanks for you help.
now ,another question :
in the script ,I declare a array whose type is int, int [] wage. in the out property of the C# node;
I want to do this:
int i = 0;
for(i=0;i<10;i++)
wage =i;
when compile,the error is :the property or indexer "ScriptBase.wage"cannot be applied in the context,for that it lack the getter method.
I just describe the error in my way .

while when I declare a int variable ,the error do not exist;
so ,why ?
I think the variables we declare,their property both are "protected",I don't know the difference between the int a and int [] a.

can you give me some tip or help.

Re: how to use a C#node to visit MySql database and operate

Posted: 01 Aug 2013, 10:33
by Christian Krix Schmidt
You cannot assign values to individual indices of an output property array in the script. You have to use a temporary array in the script first. Make all changes to that array inside the script and then afterwards assign this full array to the output property array.

Re: how to use a C#node to visit MySql database and operate

Posted: 17 Dec 2015, 13:29
by serourian
Please can anybody post a small example. thank u.