在ASP.NET中使用数据集填充tableadapter [英] Filling tableadapter with dataset in asp.net

查看:60
本文介绍了在ASP.NET中使用数据集填充tableadapter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了一个数据集并与我的表连接(添加新项>>数据集),然后尝试使用以下代码用我的数据集填充Tableadapter.但是它显示了一个错误.有人可以帮我吗?

I have added a dataset and connected with my table (Add New Item >> DataSet) Then I am trying to use the following code to fill Tableadapter with my dataset. But it is showing an error. Could anybody help me please?

Dim dAdt As New SqlDataAdapter()
    dAdt.Fill(dsArticles, "tblArticles")


另请注意,我也在数据集上添加了一个参数(其中ProductID = @ PID),谢谢


Please also note I have put a parameter on my dataset as well (where ProductID=@PID) Thanks

推荐答案

此链接将为您的问题提供很大帮助:-

http://msdn.microsoft.com/en-us/library/bh8kx08z.aspx [ ^ ]

如果可以帮助您,请别忘了将此标记为您的答案.

谢谢
this link will prove to be of much help for your question:-

http://msdn.microsoft.com/en-us/library/bh8kx08z.aspx[^]

Don''t forget to mark this as your answer if it helps you out.

Thanks


请在数据适配器中添加连接和SQL查询,如

昏暗的dAdt作为新的SqlDataAdapter("select * from table",con)
dAdt.Fill(dsArticles,"tblArticles")

con =您与数据库的连接
(从表中选择*" =请插入您的查询
Please add connection and SQL query in Data Adapter like

Dim dAdt As New SqlDataAdapter("select * from table",con)
dAdt.Fill(dsArticles, "tblArticles")

con = your connection to database
("select * from table" = please insert your query


使用添加新>>数据集添加数据集并进行配置.
然后在表单的名称空间中,将引用添加为
导入DemoApplication.dsArticlesTableAdapters

Demoapplication是应用程序的名称,而dsArticles是添加的DataSet的名称.

然后在要访问数据集和表的按钮中,添加代码:
Add dataset using Add New >> Dataset and configure it.
Then in the namespace of the forms, add reference as
Imports DemoApplication.dsArticlesTableAdapters

Demoapplication is the name of your application and dsArticles is the name of added DataSet.

Then in the button, where you want to access the dataset and table, add code:
' Access Table Adapter
       Dim ta As New tblArticlesTableAdapter()
       ' Access Dataset
       Dim dt As dsArticles.tblArticlesDataTable = ta.GetData(txtArtNo.Text)
       MsgBox(dt.Rows.Count)


这篇关于在ASP.NET中使用数据集填充tableadapter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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