使用mysql和';'的C#表适配器查询象征 [英] C# Table Adapter Query using mysql and the ';' symbol

查看:119
本文介绍了使用mysql和';'的C#表适配器查询象征的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一些tableadapter,每个适配器带有几个查询,但是在使查询正常工作方面存在一些问题.

这是一个使用Visual Studio 2010 pro和6.3.5 mysql连接器的项目.

普通的可以正常工作:例如"select * from d_table where id=@idIwant"等.

但是,我找不到如何向查询中添加多行,如下所示:
(仅作为示例)

I am using some tableadapters with a couple of queries per adapter and I have some issues with getting the queries to work.

This is a project using Visual Studio 2010 pro with the 6.3.5 of the mysql connector.

Normal ones work fine: like "select * from d_table where id=@idIwant" etc.

However, I am unable to find how to add multiple lines to the query like this:
(just as an example)

SET @id:=0;
select *,@id:=@id+1 as rowid from d_table;



尽管此查询可以在mysql sql窗口中找到,但只要在表适配器查询的行末添加;"符号,Visual Studio就会失败.并且它将不接受标准的mysql'':=构造..

我一定缺少一些愚蠢的东西,因为我找不到关于此错误的信息,或者我错过了C#中的表适配器仅限于一行查询且不能使用标准mysql格式的事实.

有人有什么想法吗?

(我正在修复传给我的遗留代码...)

谢谢
rcp



While this query works find in a mysql sql window Visual studio fails whenever add the '';'' symbol to the end of a line in a table adapter query. AND it will not accept standard mysql '':=" constructs..

I must be missing something silly as I could not find info on this error or I missed the fact that table adapters in C# are limited to ONE line of query and can not use standard mysql formats.

Anyone have any ideas?

(I am fixing legacy code passed off to me...)

THANKS
rcp

推荐答案

有关"它将不接受标准mysql'':=结构"的注释.
连接字符串中有一个名为"允许用户变量"的选项-默认为false.

将此设置为true表示提供程序需要SQL中的用户变量.此选项是在Connector/NET版本5.2.2中添加的.

但是您可能已经解决了问题:-)
A comment about "it will not accept standard mysql '':=" constructs".
There is an option in the connection string called "Allow User Variables" - Default to false.

Setting this to true indicates that the provider expects user variables in the SQL. This option was added in Connector/NET version 5.2.2.

But you probably have solved your problem :-)


这篇关于使用mysql和';'的C#表适配器查询象征的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆