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

Q and A about functionality and how to solve a special task for your application.

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

Postby zhaohuifu » 31 Jul 2013, 07:09

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!.
zhaohuifu
 
Posts: 11
Joined: 09 May 2013, 03:05

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

Postby SamTheSwede » 31 Jul 2013, 20:27

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
SamTheSwede
 
Posts: 76
Joined: 18 Jan 2012, 11:31

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

Postby zhaohuifu » 01 Aug 2013, 09:53

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] =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.
zhaohuifu
 
Posts: 11
Joined: 09 May 2013, 03:05

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

Postby Christian Krix Schmidt » 01 Aug 2013, 10:33

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.
Christian Krix Schmidt
 
Posts: 270
Joined: 18 Jan 2012, 11:36
Location: Dubai, United Arab Emirates

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

Postby serourian » 17 Dec 2015, 13:29

Please can anybody post a small example. thank u.
serourian
 
Posts: 21
Joined: 30 Jun 2015, 12:06


Return to How to...

cron