如何在Windows窗体的数据库访问中使搜索数据按钮,我正在尝试但失败 [英] How to make button for search data in database access in windows form,i'm trying but faliure

查看:95
本文介绍了如何在Windows窗体的数据库访问中使搜索数据按钮,我正在尝试但失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hii,每个人我都是初学者

如何以Windows形式在数据库访问中创建用于搜索数据的按钮,我正在尝试但失败.

Hii,everybody i''m beginner

How to make button for search data in database access in windows form,i''m trying but faliure to do.

推荐答案

您好,

你不能使"按钮做任何事情:D

将一个按钮拖放到表单上.双击它.在自动生成的方法中,编写代码以打开与数据库的连接.编写SELECT sql语句,其中WHERE子句将包含您要搜索的条件.执行该SQL并将其显示在datagrid或其他内容中.

示例SQL:SELECT * FROM [MyTable] MT WHERE MT.Name像''%hawkz%''
该SQL将拉出"MyTable"的所有行,其中名称"列包含字符串"hawkz"

尝试执行以下步骤并实施.我猜这对您来说并不容易.但是,请尝试发布一些给出异常或无法正常工作的代码.然后,我们会尽力帮助您找出问题所在.

希望对您有帮助.
Hi there,

You cannot ''make'' the button do anything :D

Drag and drop a button on to your form. Double click on it. In the auto generated method, write code to open a connection to your database. Write a SELECT sql statement in which the WHERE clause will contain the criteria you want to search from. Execute that SQL and display it in a datagrid or something.

Sample SQL: SELECT * FROM [MyTable] MT WHERE MT.Name LIKE ''%hawkz%''
This SQL will pull all rows of ''MyTable'' where ''Name'' column contains the string ''hawkz''

Try following these steps and implementing it. It won''t be easy for you I guess. But try and post some code that gives an exception or does not work as you hope. Then we''d try and help you figure out where the problem is.

Hope this help you.


这篇关于如何在Windows窗体的数据库访问中使搜索数据按钮,我正在尝试但失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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