更新数据源 [英] Update data source
问题描述
您好,
我正在编写一个库存管理程序,这是人们
可以管理所谓的"flobins"的放置,它们每个都有一个
位置,并由某种材料类型组成.该数据库是
在SQL Server 2005上运行,在我的应用程序中,我能够
检索记录.然后将它们存储在数据集中,以最小化
如果我想更新我的数据库的交易数量
数据源我更新了数据适配器,应该是我认为的.一世
仍然无法更新原始数据.有人可以告诉我
要遵循的步骤以及其他需要牢记的事情?
通过这段代码,我将所有数据存储在数据集中:
公共无效CreateDataset(){
adpLocatie = data.Adapter("SELECT * from locatie");
adpLocatie.Fill(dataset,"locatie");
tbllocatie =数据集.Tables["locatie"];
adpType = data.Adapter("SELECT * from materiaaltype");
adpType.Fill(数据集,材料类型");
tblmateriaaltype =数据集.Tables["materiaaltype"];
adpFlobin = data.Adapter("SELECT * FROM flobin");
adpFlobin.Fill(dataset,"flobin");
tblflobin =数据集.Tables["flobin"];
}
与此相关,我更新了源代码:
公共无效UpdateDataset(){
SqlCommandBuilder bFlobin =新的SqlCommandBuilder(adpFlobin);
SqlCommandBuilder bLocatie =新的SqlCommandBuilder(adpLocatie);
SqlCommandBuilder bType =新的SqlCommandBuilder(adpType);
adpFlobin.Update(tblflobin);
adpLocatie.Update(tbllocatie);
adpType.Update(tblmateriaaltype);
adpFlobin.Update(dataset,"flobin");
adpLocatie.Update(dataset,"locatie");
adpType.Update(dataset,"materiaaltype");
}
我没有错,他只是不会更新.请帮助我,
戴维
Hello,
I am writing a program for stock management, it's the idea that people
can manage the placing of so called "flobins", they each have a
location and consist of a certain material type. The database is
running on a SQL server 2005 and in my application I am able to
retrieve the records. I then store them in a dataset so minimalise the
number of transactions back to the database, if I want to update my
data source I update the data adapter so that should be it i thought. I
am still unable to update the original data. Can somebody tell me which
steps to follow and other things to bear in mind?
With this piece of code i store all the data in the dataset:
public void CreateDataset() {
adpLocatie = data.Adapter("SELECT * from locatie");
adpLocatie.Fill(dataset, "locatie");
tbllocatie = dataset.Tables["locatie"];
adpType = data.Adapter("SELECT * from materiaaltype");
adpType.Fill(dataset, "materiaaltype");
tblmateriaaltype = dataset.Tables["materiaaltype"];
adpFlobin = data.Adapter("SELECT * FROM flobin");
adpFlobin.Fill(dataset, "flobin");
tblflobin = dataset.Tables["flobin"];
}
With this i update the source:
public void UpdateDataset() {
SqlCommandBuilder bFlobin = new SqlCommandBuilder(adpFlobin);
SqlCommandBuilder bLocatie = new SqlCommandBuilder(adpLocatie);
SqlCommandBuilder bType = new SqlCommandBuilder(adpType);
adpFlobin.Update(tblflobin);
adpLocatie.Update(tbllocatie);
adpType.Update(tblmateriaaltype);
adpFlobin.Update(dataset, "flobin");
adpLocatie.Update(dataset, "locatie");
adpType.Update(dataset, "materiaaltype");
}
I don't get an error, he just won't update. Please help me,
Davy
推荐答案
您好,
感谢您的发帖!不幸的是,目前没有论坛来发布您要提问的问题,因此我建议您将问题发布到以下SQL Server新闻组之一:希望有帮助!
这篇关于更新数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!