在VB2005中将组合框绑定到sql语句结果 [英] Bind combobox to sql statement result in VB2005

查看:56
本文介绍了在VB2005中将组合框绑定到sql语句结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用服务器资源管理器在我的数据库中创建包含表的数据集。我能够将
绑定到我的组合框并通过包含where子句来设置过滤器。但我无法在select语句中将
concat 2列作为添加列而不会出现错误。似乎

我被限制只使用表中的列。


如何将组合框绑定到SQL语句的结果集?


此外,我需要从组合框的selectedvalue同步数据网格的内容。任何

想法?

I am able to use the Server Explorer to create a dataset containing tables in my database. I am able
to bind a table to my combobox and set a filter by including a where clause. But I am unable to
concat 2 columns as an addition column in the select statement without getting an error. It seems
that I am restricted to use only the columns of the table.

How do I bind a combobox to the resultset of a SQL statement?

Furthermore, I need to sync the contents of a datagrid from the selectedvalue of the combobox. Any
ideas?

推荐答案

发布你的代码(至少像你的查询一样),我们也许可以提供帮助你好。


Robin S.


" guy" < gu*@hotmail.com写信息

新闻:c8 ***************************** *** @ 4ax.com ...
Post your code (like your query at least), and we may be able to help you.

Robin S.

"guy" <gu*@hotmail.comwrote in message
news:c8********************************@4ax.com...

>我可以使用服务器资源管理器在我的数据库中创建包含表格的数据集。我能够将
绑定到我的组合框并通过包含一个

子句来设置过滤器。但是我无法在选择语句中添加
concat 2列作为添加列而没有

收到错误。似乎

我被限制只使用表中的列。


如何将组合框绑定到SQL语句的结果集?


此外,我需要从组合框的

selectedvalue中同步数据网格的内容。任何

想法?
>I am able to use the Server Explorer to create a dataset containing tables
in my database. I am able
to bind a table to my combobox and set a filter by including a where
clause. But I am unable to
concat 2 columns as an addition column in the select statement without
getting an error. It seems
that I am restricted to use only the columns of the table.

How do I bind a combobox to the resultset of a SQL statement?

Furthermore, I need to sync the contents of a datagrid from the
selectedvalue of the combobox. Any
ideas?



2007年3月8日星期四22:11:52 -0800,RobinS < Ro **** @ NoSpam.yah.nonewrote:
On Thu, 8 Mar 2007 22:11:52 -0800, "RobinS" <Ro****@NoSpam.yah.nonewrote:

>发布您的代码(至少与您的查询一样),我们也许可以提供帮助你好。

Robin S.
>Post your code (like your query at least), and we may be able to help you.

Robin S.



这个问题与可视化编程有关,所以唯一的代码就是SQL。我在TableAdapter配置中找到了查询

Builder。似乎sql解析器只将加号(+)识别为

字符串连接运算符,但这不能移植到使用ANSI SQL标准的其他RDBMS

垂直酒吧" ||"字符串连接运算符。


TableAdapter查询生成器解析器不接受以下ANSI SQL,尽管

语句正确执行:

选择sColumn1 || sColumn2作为mytable的expr1;


以下SQL在SQL Server中有效,但不能移植到其他RDBMS:

从mytable中选择sColumn1 + sColumn2作为expr1 ;

The problem has to do with visual programming so the only code is SQL. I tracked down to the Query
Builder in TableAdapter Config. It seems that the sql parser only recognizes the plus sign (+) as a
string concatenation operator but this is not portable to other RDBMS that use the ANSI SQL standard
vertical bars "||" string concatenation operator.

The following ANSI SQL is not accepted by the TableAdapter Query Builder parser although the
statement executes properly:

select sColumn1 || sColumn2 as expr1 from mytable;

The following SQL works in SQL Server but it is not portable to other RDBMS:
select sColumn1 + sColumn2 as expr1 from mytable;


呵呵?


我真的不确定我以前见过..那是mySql ?


我的意思是你真的认为那是ANSI吗?


-Aaron



3月9日下午5:58,家伙< g ... @ hotmail.comwrote:
huh?

Im really not sure i''ve seen that before.. is that mySql?

I mean do you really think that is ANSI?

-Aaron


On Mar 9, 5:58 pm, guy <g...@hotmail.comwrote:

2007年3月8日星期四22:11: 52-0800,RobinS < Rob ... @ NoSpam.yah.nonewrote:
On Thu, 8 Mar 2007 22:11:52 -0800, "RobinS" <Rob...@NoSpam.yah.nonewrote:

发布您的代码(至少与您的查询一样),我们也许能够为您提供帮助。
Post your code (like your query at least), and we may be able to help you.


Robin S.
Robin S.



这个问题与可视化编程有关代码是SQL。我在TableAdapter配置中找到了查询

Builder。似乎sql解析器只将加号(+)识别为

字符串连接运算符,但这不能移植到使用ANSI SQL标准的其他RDBMS

垂直酒吧" ||"字符串连接运算符。


TableAdapter查询生成器解析器不接受以下ANSI SQL,尽管

语句正确执行:

选择sColumn1 || sColumn2作为mytable的expr1;


以下SQL在SQL Server中有效,但不能移植到其他RDBMS:

从mytable中选择sColumn1 + sColumn2作为expr1 ;


The problem has to do with visual programming so the only code is SQL. I tracked down to the Query
Builder in TableAdapter Config. It seems that the sql parser only recognizes the plus sign (+) as a
string concatenation operator but this is not portable to other RDBMS that use the ANSI SQL standard
vertical bars "||" string concatenation operator.

The following ANSI SQL is not accepted by the TableAdapter Query Builder parser although the
statement executes properly:

select sColumn1 || sColumn2 as expr1 from mytable;

The following SQL works in SQL Server but it is not portable to other RDBMS:
select sColumn1 + sColumn2 as expr1 from mytable;



这篇关于在VB2005中将组合框绑定到sql语句结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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