我试图建立一个数据库应用程序 [英] Im trying to build a database application

查看:86
本文介绍了我试图建立一个数据库应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,对不起我的英语,我在这里尝试做的是:



我已经有一个学生数据库,这只是一个测试,但我有关于那些学生的ID,姓名和其他信息,



我想编写一些视觉基础应用程序,当我输入学生ID时,它将显示其余的关于学生的信息,我该怎么做? x)

Hey guys, sorry about my english, What im trying to do here is:

I already have a database for students, this is just a test but i have the id, names and other info about those students,

and i want to program some visual basic application that when i enter the students ID it will display the rest of the info about the student, so how do i do that? x)

推荐答案

我不知道如何在vb中执行此操作但在c#中您可以使用sqldataadapter查询所需的结果。







string studid =你的学生ID



SqConnection myconnection = new SqlConnection(@YourConnectionstring here);

SqlDataAdapter myadapter = new SqlDataAdapter();

myadapter.SelectCommand = myconnection.CreateCommand(); < br $>


myadapter.SelectCommand.Commandtype = Commandtype.Text;

myadapter.SelectCommand.CommandText =你的查询字符串在这里;

myadapter.SelectCommand.Parameters.AddWithValue(@ param,studid);



DataTable da = new DataTable();



//填充数据表



myadapter.Fill(da);



//在数据表上绑定一个datagridview



DatagridView1.DataSource = da;











我只是一个新手试图帮助...... :)
i don''t know how to do it in vb but in c# you can use an sqldataadapter to query the results you want.



string studid = "Your student id"

SqConnection myconnection = new SqlConnection(@"YourConnectionstring here");
SqlDataAdapter myadapter = new SqlDataAdapter();
myadapter.SelectCommand = myconnection.CreateCommand();

myadapter.SelectCommand.Commandtype = Commandtype.Text;
myadapter.SelectCommand.CommandText = "Your Query String here";
myadapter.SelectCommand.Parameters.AddWithValue("@param",studid);

DataTable da = new DataTable();

//fill the datatable

myadapter.Fill(da);

//bind the your a datagridview on the datatable

DatagridView1.DataSource = da;





I''m just a newbie trying to help.. :)


这篇关于我试图建立一个数据库应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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