如何在C#中动态构建自定义用户查询 [英] how to build customized user queries dynamically in C#

查看:95
本文介绍了如何在C#中动态构建自定义用户查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的需要一些指导,我想创建一个显示数据库中的列的GUI,允许最终用户选择他想要查询的列,一旦他选择了他的列,他是什么渴望用它做什么?例如,它可能是一个select,update或delete语句,之后,我们必须让他们使用WHERE子句,以便他们可以更具体地了解他们的查询,不仅如此,我们还必须给他们机会要进行连接查询,这样他们就可以选择多个列,并且他们也可以选择要从表中显示的特定字段。



PLZ给出我是一个起点,在某个地方,我可以开始解决这个问题,或者也许是一些例子,你们可以让我更好地了解如何开始这样做。



顺便说一下,这必须是C#,所以我非常感谢你们给我提供的任何指导。



非常感谢你的时间和我希望你们能帮助我解决这个问题。



如何创建查询构建器?我有一个表,我需要在运行时动态查询。我必须使用select和Where从表和查询中选择特定的列;条款我是初学者,我不知道如何开始这项工作。 Plz任何人都可以帮助我。

I seriously need some guidance here, I want to create a GUI that displays the columns from the database, allowing the end-user to choose what column he desires to query, once he has chosen his column(s) what does he desire to do with it? for instance it could be a select, update or delete statement, after that, we have to let them make use of the WHERE clause so that they can be more specific about their queries, not only that, we also have to give them the chance to make join queries, so they can select more than one columns, and also they have be able to select specific fields they want to show from their tables.

PLZ give me a starting point, some place where I can begin working this out, or maybe some examples you guys can provide me to give me a better idea on how to start doing this.

By the way this has to be in C#, so I really appreciate any guidance you guys can provide me.

Thank you so much for your time and I hope you guys can help me out on this one.

How can i Create a Query builder? I have a table which i need to query dynamically at run time. I have to choose specific columns from table and query using select and Where ; clause I am a beginner i dont know how to start this work. Plz can anyone help me out.

推荐答案

你应该找到这个CodeProject文章 SelectQueryBuilder:从C#构建复杂而灵活的SQL查询/命令 [ ^ ]很有用。它声称也包括SQL注入。
You should find this CodeProject article SelectQueryBuilder: Building complex and flexible SQL queries/commands from C#[^] useful. It claims to cover SQL Injection too.


这篇关于如何在C#中动态构建自定义用户查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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