如何用数据库创建幻灯片? [英] How to create slide show with database?
问题描述
我想使用ajax幻灯片放映器创建幻灯片放映,我想在数据库中使用已保存的图像。怎么做????
PLz帮助我感谢<
试试以下两个链接
http: //www.dotnetcode.in/2011/07/how-to-slideshow-images-from-database.html [ ^ ]
从数据库获取图像到Ajax ToolKit幻灯片放大器 [ ^ ]
希望以正确的方式理解您的问题,以上链接有帮助。
< blockquote> 创建幻灯片
幻灯片放映s是客户端编程的工作,您可以动态更新网站的内容。 JavaScript是您应该使用的主要语言。 ASP.NET虽然能够解决客户端交互问题。但使用JavaScript是更有效的方法。
从数据库获取数据
首先,您需要确保,您的数据库具有图像名称,保存在表中。如果是这样,您可以继续下一步,从表中提取内容。在ASP.NET中,您编写以下代码以从连接的数据库中获取数据。
var db = Database.Open( databaseName);
var selectQuery = SELECT * FROM table_name 跨度>;
// 因为我们只使用image_name列,
// 这不是问题,写'SELECT image_name_column'
// 现在查询数据。
var imageNames = db .Query(selectQuery);
这样,现在imageNames存在于 imageNames $ c中$ c>变量。您现在可以通过它填充客户端变量。或者,您可以为JavaScript生成隐藏列表以从中获取imageNames。
客户端代码
在客户端,您可以使用无论是JavaScript还是自己动手,或者您可以使用一些已经构建的jQuery库来使用它们。
您可以开始使用的一些库。
只注意这些,谷歌充满了你的更多伟大的东西可以在您的项目中添加和使用。在尝试创建某些内容之前,请尝试查找已构建的解决方案。
Hi,
I want to create slide show using ajax slide show Extender,I want to used saved images in database. How to do that????
PLz Help ME THANKS<
Try the below two links
http://www.dotnetcode.in/2011/07/how-to-slideshow-images-from-database.html[^]
Getting images from data base to Ajax ToolKit slide show extender[^]
Hope have understood your problem in a correct manner and the above links helps.
Creating Slide Shows
Slide shows are a work of client-side programming where you dynamically update the content of the website. JavaScript is the main language that you should use. ASP.NET although can be able to work around with the client-side interactions. But using JavaScript is more efficient way of doing this.
Getting data from Database
First you need to make sure, that your database has the image names, saved in a table. If so, you can then continue to the next step, of extracting the stuff from the table. In ASP.NET you write the following code to get the data from a connected database.
var db = Database.Open("databaseName"); var selectQuery = "SELECT * FROM table_name"; // since we will only use the image_name column, // it is not a problem, writing 'SELECT image_name_column' too // now query the data. var imageNames = db.Query(selectQuery);
This way, now the imageNames are present inside theimageNames
variable. You can now populate a client-side variable through it. Or, you can generate a hidden list for the JavaScript to get the imageNames from.
Client side code
In the Client Side, you can use either JavaScript and do it yourself, or you can use some of the already built jQuery libraries to work with.
Some libraries that you can start working with.
- bxSlider[^] is a great jQuery library to work with these slideShow stuff in jQuery.
- WowSlider[^] is another plugin.
Note only these, Google is filled up with more of great stuff that you can add and use in your project. Before trying to create something, try to look for a solution that was already built.
这篇关于如何用数据库创建幻灯片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!