如何在C#中浏览MySQL数据 [英] how to Browse MySQL data in C#

查看:74
本文介绍了如何在C#中浏览MySQL数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我想使用这个按钮开始查看/浏览我的数据表单MYSQL开始(>>),上一个(<),下一个(>),最后一个(>>)每当我点击最后一个按钮它将以MYSQL中的数据结尾为例。当点击下一个按钮时,它将浏览下一个数据..感谢您的回答。上帝保佑!! :))



我的表格



我的Google+论坛 [ ^ ]

解决方案

这里是一个示例的。下次尝试使用谷歌之前提问,这些问题在互联网上有很多答案。


嘿Black Diamond,



这实际上是非常简单的SQL编程。有几种方法可以解决它,我认为你之所以没有太多的东西,是因为你没有关于一个主题或控件的具体问题,而是你要求人们编写整个程序您。我建议你先阅读这篇文章:



将C#连接到MySQL [ ^ ]



它将解释MySQL数据库查询的基础知识,并且还有一些很好的方法供您使用,这将非常方便。简而言之:



*如果您要搜索的数据量不是很多,只需从数据库中选择所有内容即可将其放入a数据表。这样您就可以从资源中节省宝贵的插槽时间。

*为每个按钮分配一个事件并相应地设置动作。例如,如果按下前进按钮,则整数值将增加1,这将在de datatable.Select 方法中使用或循环遍历数据表行,使用 foreach 迭代。双向前按钮可以附加一个选择语句,例如

 DataRow row = datatable.Rows [datatable.Rows.Count  -  1]; 

这将返回最后一行在表中,可以用来填写表格。



如果保持连接打开不成问题,您当然可以直接查询数据库。同样,您需要一个参考点来构建SQL查询以确保返回正确的结果。



我希望这个简短的问题可以帮到你。干杯!


hey, i want to view/browse my datas form MYSQL using this buttons begin(>>), previous(<), next(>), last(>>) whenever i clicked the last button it will goes to the end of the Data in MYSQL for example. and when the next button is clicked then it will browse the next data.. thanks for answering. GODBLESS!! :))

my form

My Google+ forum[^]

解决方案

Here is an example. Next time try to use google before asking questions, which have a lot of answers in the internet.


Hey Black Diamond,

This is actually pretty straight forward SQL programming. There are several ways to go about it and I think the reason why you don't have much anwsers yet, is because yoú don't have a specific question about one topic or control, but rather you ask people to write the entire program for you. I'd suggest you read this article first :

Connect C# to MySQL[^]

It will explain the basics of MySQL database querying and also has a few great methods for you to use which will come in very handy. In a nutshell :

* If the amount of data that you'd like to search is not a whole lot, just select everything from the database an chuck it into a datatable. That way you spare valuable socket time from your resources.
* assign an event to each button and set the action accordingly. For example, if you press the forward button then an integer value will be increased by one, which is use in de datatable.Select method or looping through the datatable rows, using the foreach iteration. The double forward button could have a selection statement attached to it, such as

DataRow row = datatable.Rows[datatable.Rows.Count - 1];

This will return the last row in the table and can be used to fill in the form.

If keeping connections open is not a problem, you could of course query directly to the database. Again, you'd need a reference point to construct your SQL queries to ensure a proper result back.

I hope this short anwser to an extensive question will get you going. Cheers !


这篇关于如何在C#中浏览MySQL数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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