开发者

LINQ to SQL DataContext Issue

开发者 https://www.devze.com 2023-03-28 10:36 出处:网络
I have finally gotten to the point that I am ready to put the new website that I have been working on for a few weeks live and have bumped into the following error:

I have finally gotten to the point that I am ready to put the new website that I have been working on for a few weeks live and have bumped into the following error:

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

my connection string

 clientconnectDataContext db = new clientconnectDataContext();

this is happens whenever I try and load a page that is running a Linq to SQL query. I have the dbml file on the server and its named correctly, everything is also working on the localhost only when I put it live does it throw the error. The only thing I could think of is that I am hosting this in a folder off of the main website and that the App_folder needs to be just off the root of the website (I have tried it in both places to no a开发者_开发技巧vail) I know that not putting the website in the root of the host has caused other issues that I have dealt with.

I know that this is a very vague question and I tried to include as much info as I could, if you need any other information I will respond with it.

Thanks!


If its a website then make sure you have uploaded all three files which make up the *.dbml file, without all the files IIS won't know how to compile the code:

YourDataContext.dbml
YourDataContext.dbml.layout
YourDataContext.dbml.designer.cs


Try clientconnectDataContext() with the database connection string

clientconnectDataContext db = new clientconnectDataContext("put your connection string to your database here ");
0

精彩评论

暂无评论...
验证码 换一张
取 消