使用c Sharp搜索记录 [英] searching records using c sharp
本文介绍了使用c Sharp搜索记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了三个属性(stud_id,姓名,性别)创建了新项目(例如学生)和ms-access数据库(dbstudents)
在项目中,我将在文本框中输入stud_id
剩余的数据将显示,
请帮助我如何为此编写代码
感谢
i created new project(ex. students) and ms-access database(dbstudents) in that three attributes i used(stud_id, name, gender)
in the project i will enter the stud_id in the textbox
remaining data will be displayed,
pls help me how to write code for that
thanks
推荐答案
无论如何我今天心情很好;
在此处检查此链接;
具有Access DB的C#中的Crud操作 [如何在C#应用程序中链接到Access数据库 [ Access 2007的连接字符串 [ ^ ]
Anyways I am in a good mood today;
Check this link here;
Crud operations in C# with Access DB[^]
or this;
How to link to an Access Database in a C# Application[^]
For connection strings check here for more detailed info;
Connection strings for Access 2007[^]
您需要提供更多信息-您创建了哪种项目? MFC? C#Windows表单? WPF?
数据库中是否包含任何数据,或者您需要添加数据库?
数据库是否存在,是否需要创建模式?
You need to provide more information - what sort of project did you create? MFC? C# Windows Forms? WPF?
Does the database have any data in it or do you need to add it?
Does the database exist, do you need to create the schema?
从表中选择* *,其中stud_id ="+ TextBox1.Text +";
读者阅读并显示的内容
str name = rdr [0] .ToString();
str sex = rdr [1] .ToString();
Write Select * from table where stud_id="+TextBox1.Text+";
the read by a reader and display
str name=rdr[0].ToString();
str gender=rdr[1].ToString();
这篇关于使用c Sharp搜索记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文