什么是数据源可以解释 [英] what is datasource can u explain

查看:74
本文介绍了什么是数据源可以解释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是数据源以及它是如何有用的,你能用code.i知道一些关于数据源但是告诉我工作可以帮助我...

what is data source and how it is useful and can you tell me with code.i know a little about the data source but tell me working can u help me...

推荐答案

数据源控件:



Data Source Controls:

引用:

ASP.NET包含数据源控件,允许您使用不同类型的数据源,如数据库,XML文件或中间层业务对象。数据源控件连接到数据源并从中检索数据,并使其可供其他控件绑定,而无需代码。它们还可以支持修改数据。



本主题提供有关ASP.NET中不同类型的数据源控件的信息。数据源控件模型是可扩展的,因此您还可以创建自己的数据源控件,这些控件可以与不同的数据源交互,或者为现有数据源提供附加功能。

ASP.NET includes data source controls that allow you to work with different types of data sources such as a database, an XML file, or a middle-tier business object. Data source controls connect to and retrieve data from a data source and make it available for other controls to bind to, without requiring code. They can also support modifying data.

This topic provides information about the different types of data source controls in ASP.NET. The data source control model is extensible, so you can also create your own data source controls that interact with different data sources or that provide additional functionality for an existing data source.





在VB.Net





In VB.Net

Dim nwindConn As SqlConnection = New SqlConnection("Data Source=localhost;Integrated Security=SSPI;" & _"Initial Catalog=northwind")
nwindConn.Open()



[C#]


[C#]

SqlConnection nwindConn = new SqlConnection("Data Source=localhost; Integrated Security=SSPI;" + "Initial Catalog=northwind");
nwindConn.Open();


数据源控件概述 [ ^ ]



数据源控件 [ ^ ]



参考这些链接,您将了解什么是数据源以及有什么用途。
Data Source Controls Overview[^]

Data Source Controls[^]

Refer these links, you will understand what is the data source and what is the use.


您好朋友...





在数据源控制的帮助下,我们可以通过编写一些数据访问代码来执行数据绑定操作。这用于从服务器中检索DataReader或DataSet对象,您可以在DataGrid,DropDownLIst或ListBox中显示已检索的数据。



示例:



SqlConnection con = new SqlConnection();



SqlCommand cmd = new SqlCommand(Select * from Emp,con);







SqlDataAdapter da = new SqlDataAdapter(cmd);







DataSet ds =新的DataSet();



da.Fill(ds);







GridView1.DataSource = ds;



GridView1.DataBind();



乐于助人
Hi friend...


With the help of Data Source Control, we can perform the data binding operation by writing some data access code. This is used to retrive a DataReader or a DataSet object from the server and you can show that retrived data in DataGrid, DropDownLIst or in ListBox.

Example:

SqlConnection con = new SqlConnection();

SqlCommand cmd = new SqlCommand("Select * from Emp", con);



SqlDataAdapter da = new SqlDataAdapter(cmd);



DataSet ds = new DataSet();

da.Fill(ds);



GridView1.DataSource = ds;

GridView1.DataBind();

Happy to help


这篇关于什么是数据源可以解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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