简体   繁体   中英

C# Tableadapter dataset reference

I have a dataset named: FileUploadDataSet.xsd

and i have the following table adapter:

在此输入图像描述

The start of my default.aspx.cs page looks like this:

在此输入图像描述

But i get the following error:

The type or namespace name 'FileUploadDataSetTableAdapters' could not be found (are you missing a using directive or an assembly reference?)

I want to bind the dataset with a gridview and then would like to carry out some insert statements also. But i cant seem to get out of first gear. My dataset is saved in the App_Code folder.

Any ideas to get a young C# nOObie going with this please?

this may be name what you given on using statment not match with the real class name.

press CTRL + W , C or view => class view

find your table adapter class and drag and drop to code area. then it will give you the full class name with namespace like DataSet1TableAdapters.t1TableAdapter

you can move DataSet1TableAdapters to using statement and use directly t1TableAdapter

there is no issue with having data set on your app code folder.

Edit: if you are not see the classes generated from Dataset you may need to recreate it correctly.

Open Dataset Adapter from Solution Explorer and go to the properties window if doesnot open by right click, go to View menu and open. There are two properties one is namespace and other is name. You have to change the namespace (http://tempuri.org/DatabaseBookingDAL.xsd) to (http://tempuri.org/ Your namespace Name .xsd) and also change the name properties of your class

I have the same problem, solved by add this code:

using test.App_Data.testDataSetTableAdapters;

where:

test : the name of your project

App_Data : folder contain your database

testDataSet : the name of your data set

it's work correctly :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM