ventuz连接mysql8.0操作
Ventuz-MySQL8.0数据连接操作说明
方法介绍
Ventuz连接数据库有两种方法:
第一种:采用database节点连接query查询
第二种:写c#脚本连接
- 方法一:
前期准备
工具:ventuz designer5 MySQL8.0
设置节点:
![](/assets/blank.gif)
图1-1 ventuz节点图
C#脚本
双击c#脚本节点,设置input output
Input:点击+号键添加Method1 和reset方法
Output:点击+号键添加String1变量用于输出数据库值(方法数量、方法体及变量类型根据需要设定)
![](/assets/blank.gif)
图1-2 input设置
脚本代码:
using System; - using Ventuz.Kernel; - using System.Data.Odbc; - using System.Data; - - public class Script : ScriptBase, System.IDisposable - { - // This member is used by the Validate() method to indicate - // whether the Generate() method should return true or false - // during its next execution. - private bool changed; - - // This Method is called if the component is loaded/created. - public Script() - { - // Note: Accessing input or output properties from this method - // will have no effect as they have not been allocated yet. - } - - // This Method is called if the component is unloaded/disposed - public virtual void Dispose() - { - } - - // This Method is called if an input property has changed its value - public override void Validate() - { - // Remember: set changed to true if any of the output - // properties has been changed, see Generate() - } - - // This Method is called every time before a frame is rendered. - // Return value: if true, Ventuz will notify all nodes bound to this - // script node that one of the script's outputs has a - // new value and they therefore need to validate. For - // performance reasons, only return true if output - // values really have been changed. - public override bool Generate() - { - changed = true; - return true; - } - - // This Method is called if the function/method Method1 is invoked by the user or a bound event. - // Return true, if this component has to be revalidated! - public bool OnMethod1(int arg) - { - String1 = ""; - string strconn = "DRIVER={MySQL ODBC 8.0 Unicode Driver};SERVER=localhost;DATABASE=databaseName;USER=userName;PASSWORD=password;OPTION=3;"; - string sql = "select name from table"; - OdbcConnection con = new OdbcConnection(strconn); //建立连接对象 - con.Open(); - OdbcCommand com = new OdbcCommand(sql, con); //执行查询语句赋值给com对象 - OdbcDataReader reader = com.ExecuteReader(); - //读到数据时写入String1 - while (reader.Read()) - { - String1 += reader[0].ToString() + " "; - } - con.Close(); - return true; - } - - // This Method is called if the function/method reset is invoked by the user or a bound event. - // Return true, if this component has to be revalidated! - public bool Onreset(int arg) - { - String1 = ""; - return false; - } - }
执行
点击图示方法即可显示数据库内容
图1-3 执行结果
- 方法二
前期准备
设置节点:
图2-1 ventuz节点图
连接字符串:可以查询官网:https://www.connectionstrings.com/
我的数据库版本是mysql8.0 采用ODBC连接
图2-2 odbc数据源设置
附我的ConnectionString供参考:
DRIVER={MySQL ODBC 8.0 Unicode Driver};SERVER=localhost; DATABASE=databaseName; USER=userName; PASSWORD=password;OPTION=3;
细节操作
Query节点
Query节点用于书写sql语句,点击执行即可查看输出结果
图2-3 query节点设置
Row节点
Ventuz通过query节点输出dataset,row节点就用来显示dataset
图2-4 row节点input设置
要实现数据绑定,要选择output的数据类型并设置数据名称,要与数据库定义对应
图2-5 row节点output设置
ventuz连接mysql8.0操作相关推荐
- mysql8连接java_JAVA连接MYSQL8.0问题
title: java连接mysql8.0问题 date: 2018-07-08 19:27:38 updated: tags: description: keywords: comments: im ...
- Navicat连接MySQL8.0版本时出现Client does not support authentication protocol requested by server;报错的问题解决办法
Windown系统下 遇到 Navicat连接MySQL8.0版本时出现Client does not support authentication protocol requested by ser ...
- 七.【Python3.8+Django3.0从零开始系列】Django3.0+Python3.8连接MySql8.0及遇到的问题解决
目录 一.Django3.0连接MySql8.0准备 二.安装pymysql 三.安装mysqlclient 错误解决方法: 四.使用PyCharm的可视化数据库管理工具,连接Mysql8创建数据库 ...
- CentOS7.5下安装Mycat连接MySQL8.0
CentOS7.5下安装Mycat连接MySQL8.0 Posted on 2018-11-08 11:07 许爱琪 阅读(645) 评论(2) 编辑 收藏 MyCat详细介绍,请参考https:// ...
- Navicat远程连接MYSQL8.0
Navicat远程连接MYSQL8.0 MYSQL配置 MYSQL配置 打开my.ini配置,没有的话新建一个,内容按照如下mysql优化配置: [client] port = 3306 #客户端端口 ...
- Mycat连接Mysql8.0及以上配置及问题(已解决)
Mycat连接Mysql8.0及以上问题(已解决) 编辑server.xml 配置文件 vim conf/server.xml <!-- 修改此位置 --><user name=&q ...
- dw8与mysql的连接,VS2019连接mysql8.0数据库的教程图文详解
1.首先准备好vs2019以及mysql数据库,两者都可以去官网下载,我们直接描述连接过程. 2.连接: 第一步:打开mysql的安装目录,我本地的安装目录如下:(注意是否有include和lib文件 ...
- Navicat连接MySQL8.0出现乱码的解决方案
Navicat连接MySQL8.0出现乱码的解决方案 参考文章: (1)Navicat连接MySQL8.0出现乱码的解决方案 (2)https://www.cnblogs.com/ray-mr-hua ...
- mysql8.0client_navicat 连接mysql8.0 报错client does not support authentication
navicat 连接mysql8.0 报错client does not support authentication,解决方法: 打开windows Powershell,输入以下命令 ,加红加粗的 ...
最新文章
- mysql设置约束l命令_2、MYSQL 基本数据库命令及约束
- 另一个小程序 返回的支付结果如何得到_手把手教你测微信小程序
- js如何生成[n,m]的随机数
- 阿里大数据分析与应用(part4)--一站式大数据平台DataWorks
- java bitset用途_BitSet的用法
- ad域管理与维护_AD域管理员账号下发
- flavr—超级漂亮的jQuery扁平弹出对话框
- PV、UV、UIP、VV、CPC、CPM、RPM、CTR指的是什么?
- bzoj:1692 [Usaco2007 Dec]队列变换1640 [Usaco2007 Nov]Best Cow Line 队列变换
- Equal-size partition problem
- hdu acm 1241
- VBA的表单控件初接触(2):ActiveX控件的基础功能和基础代码
- VB6基本数据库应用(一):数据库基础
- 六自由度机械臂运动学分析及其轨迹规划
- 2021起重机作业 (Q)模拟考试题库及软件
- A Structure from Motion System
- 传染病研究-靶向下一代宏基因组测序(mNGS)分析
- 客户流失预测——相关论文学习笔记
- python视频压缩_Python 怎样将视频压缩?并且尽量不会影响到清晰度
- 中交一公局集团:提效翻倍!构建“数据共享、高效管控”的财税管理新模式