由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - Who can tell me why i cannot connect to the SQL db file ?
相关主题
Entity Framework Today?Linq to entity framework: what happens if i modified DB schema in SSMS ?
some1 using nhibernate?Entity Framework Open Sourced
[合集] some1 using nhibernate? 关于SqlDataAdapter的初级问题求助
LINQ vs nHibernatesqlserver express 安装后看不到内容
Entity frameworkVisual Studio 2012 and .net 4.5 Release candidate available for download
请问大家,目前.NET业界(美国)用的最多的技术是什么?今年的TechEd
菜人问问,你们都在database上干什么??aspConf July 17-18
LINQ to SQL VS Entity Framework用了几个小时VS2012RC 我的眼睛快瞎了
相关话题的讨论汇总
话题: click话题: data话题: database话题: choose话题: dialog
进入DotNet版参与讨论
1 (共1页)
w*s
发帖数: 7227
1
Hi 大牛们,
i downloaded AdventureWorks2012_Data.mdf,
i can open it using sql server 2012 express.
Now i'm following the book trying to create a c# project connect to it,
(the book uses NorthWind db file, i cannot open it as it's not for sql 2012)
at step 9, i choosed my db file, i click "ok", but nothing happens other
than hearing a bell.
Any help appreciated !
1. Create a new console application project called BegVCSharp_24_1_
FirstLINQtoDatabaseQuery in the
directory C:BegVCSharpChapter24.
2. Press OK to create the project.
3. To add the LINQ to Entities data source for the Northwind database, go to
the Solution Explorer pane,
click the BegVCSharp_24_1_FirstLINQtoDatabaseQuery C# project, then select
Project ➪ Add New
Data Source from the menu bar.
4. In the Choose a Data Source Type dialog box, select Database. Click Next.
5. In the Choose a Database Model dialog box, select Entity Data Model.
Click Next.
6. In the Choose Model Contents dialog box, select Generate From Database.
Click Next.
7. In the Choose Your Data Connection dialog box, select New Connection.
8. In the Choose Data Source dialog box, select Microsoft SQL Server
Database File. Click Continue.
702 ❘ CHAPTER 24 APPLYING LINQ
9. In the Connection Properties dialog box, click the Browse button next to
the Database File Name (this
works for a new or existing textbox). Browse to the C:
BegVCSharpChapter24Database directory
and select Northwind.MDF as the database fi le name. Click OK to close the
windows to fi nish importing
the entity model.
10. Click Next. A popup will ask whether you want to copy the database fi le
to your project. Choose No.
11. In the Choose Your Database Objects And Settings dialog box (Entity Data
Model Wizard), expand the
Tables control, dbo control, and check Customers, Orders, and Order Details.
Click Finish and you will
now see a diagram of your entity data objects in a window labeled Model1.
edmx, as shown in Figure
24-1. If VS2012 asks if the location is trusted, answer Yes.
n*****0
发帖数: 434
2
Have you tried to click on the Test Connection button? Did it work?
w*s
发帖数: 7227
3
same thing, only hear bell.
i wonder if VS 2012 express has limitations.

【在 n*****0 的大作中提到】
: Have you tried to click on the Test Connection button? Did it work?
c*********e
发帖数: 16335
4
這個东西写起来复杂,做起来非常容易。不知道你是哪步做错了。

2012)

【在 w*s 的大作中提到】
: Hi 大牛们,
: i downloaded AdventureWorks2012_Data.mdf,
: i can open it using sql server 2012 express.
: Now i'm following the book trying to create a c# project connect to it,
: (the book uses NorthWind db file, i cannot open it as it's not for sql 2012)
: at step 9, i choosed my db file, i click "ok", but nothing happens other
: than hearing a bell.
: Any help appreciated !
: 1. Create a new console application project called BegVCSharp_24_1_
: FirstLINQtoDatabaseQuery in the

w*s
发帖数: 7227
5
ok, i used vs 2012 ultimate, not express version, it's getting better.
1. i have a existing c# project
2. connection to exiting mssql Mydb.mdf from the top steps i posted above.
now in my main.cs i try to do a test by adding 1 line,
MydbEntities mydbEntities = new MydbEntities();
my db file is Mydb.mdf
during build it says "MydbEntities" could not be found.
what should i do from here ?
thanks for helping a dummy !
c*********e
发帖数: 16335
6
MydbEntities是你的class名字?那你要import MydbEntities;

【在 w*s 的大作中提到】
: ok, i used vs 2012 ultimate, not express version, it's getting better.
: 1. i have a existing c# project
: 2. connection to exiting mssql Mydb.mdf from the top steps i posted above.
: now in my main.cs i try to do a test by adding 1 line,
: MydbEntities mydbEntities = new MydbEntities();
: my db file is Mydb.mdf
: during build it says "MydbEntities" could not be found.
: what should i do from here ?
: thanks for helping a dummy !

H*******g
发帖数: 6997
7
找个地方把你的CODE POST出来呗。
1 (共1页)
进入DotNet版参与讨论
相关主题
用了几个小时VS2012RC 我的眼睛快瞎了Entity framework
Visual Studio 2012 只能在Win 8才能使用吗请问大家,目前.NET业界(美国)用的最多的技术是什么?
vs2012的lightswitch有什么用处?菜人问问,你们都在database上干什么??
版上的童鞋们,你们升到VS2012了吗?LINQ to SQL VS Entity Framework
Entity Framework Today?Linq to entity framework: what happens if i modified DB schema in SSMS ?
some1 using nhibernate?Entity Framework Open Sourced
[合集] some1 using nhibernate? 关于SqlDataAdapter的初级问题求助
LINQ vs nHibernatesqlserver express 安装后看不到内容
相关话题的讨论汇总
话题: click话题: data话题: database话题: choose话题: dialog