如何编译选择语句(从前端) [英] how to compile a select statment(from front end)

查看:69
本文介绍了如何编译选择语句(从前端)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

   我有一个文本框。在那里我将写一个简单的select语句。当用户点击按钮时需要检查sql查询是否正确。如果是错误需要显示消息。我如何实现这一点。

    I have a textbox. In that I will write a simple select statement. When the user clicks button need to check the sql query is right or not. if it is wrong need to show a message. How I can achieve this.

ex:从emp中选择ename,其中empid = @ empid

ex: select ename from emp where empid=@empid

推荐答案

最简单的方法是将语句发送到SQL Server;如果引发错误,那么Statement就错了。

The easiest way is to send the Statement to SQL Server; if that raise an error then the Statement is wrong.

.NET中的其他方式:
TSql Parser Class

Other way in .NET: TSql​Parser Class


这篇关于如何编译选择语句(从前端)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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