求大神帮忙给扑克游戏的代码,要求用c#的web做,环境是microsoft visual Visual Stu

类似问题 &
C#语言 &&&&最新内容
C#语言 &&&&相关内容Enable Entity Framework 6 for MySql (C#) in WinForms of Microsoft Visual Studio 2013 - Stack Overflow
Join the Stack Overflow Community
Stack Overflow is a community of 7.1 million programmers, just like you, helping each other.
J it only takes a minute:
Yesterday I knew that Entity Framework is another method to access database beside using Dataset or DataReader,then I tried to make Entity Framework 6 work for my MySql database server in MVS 2013.
I open a WinForms with .Net FrameWork 4.5.1. (so I only have App.config but no app/web config in the project)
After I installed
install EntityFramework package via
TOOLS menu -> Library Package Manager -> Manage NuGet Packages for
Solution... -> Online -> (Search) EntityFramework (beware of version
of this package and it should be version 6.0.2, if not then click
Updates -> EntityFramework to update)
When I tried to add ADO.NET Entity Data Model via
Right click Project -> Add -> New Item -> ADO.NET Entity Data Model
-> Generate from Database -> New Connection
-> Data sources: -> Change...-> MySQL Database
-> Fill in the Server name with server IP, Username and Password
-> Choose the Database name-> Test Connection -> OK
Then Entity Connection string is generated -> Tick Save entity connection settings in App.Config as -> Next> ->
Which version of Entity Framework do you want to use?
Have option Entity Framework 6.0 but you cannot use it because
"Your project references the latest version of Entity F
however, an Entity Framework database provider compatible with this
version could not be found for your data connection. Exit this wizard,
install a compatible provider, and rebuid your project before
performing this action".
How to solve this?
By the way , if you install Entity Framework version 5 in Nuget Package then you might have option Entity Framework 5.0 here and you might success to use Entity Framework 5 but not the version 6.
1,94531430
First of all, we don't even need to install the mysql-installer-community-5.7.3.0-m13.msi.
Install the latest
Install the latest
New C# .Net 4.5 Framework WinForms (for 4.0 it should work based on
Install 4 Nuget Packages (follow sequence, if you install Mysql.Data.Entities before EntityFramework, it will resolve dependency and install EntityFramework 6.0.2 but what we need is EntityFramework 6.1.0)
EntityFramework
Mysql.Data
Mysql.Data.Entities
5.If you have tag entityFramework in App.config, please comment it and insert new tag entityFramework in App.config after tag startup
&entityFramework&
&defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" /&
&providers&
&provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /&
&/providers&
&/entityFramework&
6.Add ADO.NET Entity Data Model (as mentioned in question)
7.After Entity Connection string is generated (as mentioned in question) and Tick Save entity connection settings in App.Config as then click Next
8.Choose Your Database Object and Settings (Tables, Views, or Stored Procedures and Functions) (Don't have "Which version of Entity Framework do you want to use?" because I have only one Entity Framework 6.0 provider so direct skip the selection if my only provider is valid)
Congratulations ^^
By the way, you may need to add the .dll files
MySql.Data.dll
MySql.Data.Entity.EF6.dll
MySql.Web.dll
inside this folder
C:\Program Files\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5
(32bit windows)
C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5
(64bit windows)
as your project reference for further EF6 functions.
1,94531430
I followed the instructions given by V-Shy and was having the same problem as LaRae White with the wizard shutting down on me. I'm running VS2015 and had just used the MySql installer to update to MySQL for Visual Studio v1.2.6 and Connector/NET v6.9.8.
What I eventually did to get it to work was this:
Uninstall all the packages I had previously installed to solve this issue (EntityFramework, Mysql.Data, Mysql.Data.Entities, Mysql.Web)
Added the following references found in C:\Program Files (x86)\MySQL\Connector.NET 6.9\Assemblies\v4.5 manually: MySql.Data.dll, MySql.Data.Entity.EF6.dll, and MySql.Web.dll
I hope that helps someone out.
I spend entire day figuring out how to solve this problem and nothing helps.
Apparently i figure out 1 things about which people don't mention
In the model.edmx properties there is entire "DDL Generation Template", by default it set to "SSDLToSQL10.tt (VS)" but need to be set to "SSDLToMySQL.tt (VS)"
What is more it was also producing an error:
Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.
bla bla bla
line 93 c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToMySQL.tt
What leads me to the
which will be fixed in next build 1.1.4 which is not available so far.
However there is workaround fix:
Overwrite the "MySql.Data.Entity.EF6.dll" in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies
by file from NET Connector in
C:\Program Files (x86)\MySQL\MySQL Connector Net 6.8.3\Assemblies\v4.5\
Ensure that your DbContext has the annotation as shown in the MySQL documentation:
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
public partial class MyDbContext : DbContext
I kept finding that my database first ASP.NET MVC application would allow me to update my EDMX file up until I got it out of source control on another machine.
I hope that this helps someone who can't update their EDMX or finds the error when using MySQL with Entity Framework 6 as I kept getting faced with the same error until I added the annotation.
10.1k1762131
I had the same problem, and tried various fixes like the ones here, also some from the MySQL forum and still couldn't update my EDMX.
After some time (awfully long hours), I managed to get this thing working with VS 2013 update 3, .Net connector 6.9.4, Mysql for VS 1.2.3 for my MvcApplication.
First, I tried on a brand new machine, everything worked with a simple install of VS followed by the connector and Mysql for VS.
Then, I also tried with an old VS 2012 and it also worked.
I had already written some projects with EF5 on my machine and supposed the old EF5 files could be interfering with the EF6 ones.
So here's what I did, but you have to keep in mind that this is a machine-related problem and that I'm giving you a list of all the things I tried in desperation :
Delete all the MySql.*.dll in the C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies folder
Overwrite MySql.Data.Entity.dll in the folder C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies with the one in the Connector folder
Uninstall EntityFramework from your project in the Nuget console and then downgrade to EF 6.0.0 : Install-Package EntityFramework -ProjectName YourProject -version 6.0.0
Add the reference to MySql.Data.Entity.EF6 not with Nuget but by referencing the file directly (C:\Program Files (x86)\MySQL\MySQL Connector Net 6.9.4\Assemblies\v4.5\MySql.Data.Entity.EF6.dll)
My app.config file looks like this
&configuration&
&configSections&
&section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c" requirePermission="false" /&
&!-- For more information on Entity Framework configuration, visit /fwlink/?LinkID=237468 --&&/configSections&
&supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /&
&/startup&
&entityFramework&
&defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&
&providers&
&provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /&
&provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&
&/providers&
&/entityFramework&
&connectionStrings&
&!-- your connection string here --&
&/connectionStrings&
&/configuration&
And the references added in the project are these three
EntityFramework
EntityFramework.SqlServer
MySql.Data.Entity.EF6
Maybe some of the steps were useless but now I can finally update my EDMX file, and, of course, build and run the Web Project and VS doesn't seem affected by the deletion of the MySql DLLs.
Hope it helps.
I had the same issue too. In my case, I had to:
Rebuild the project after adding packages prior to starting the add model wizard.
Uninstall latest version of entity framework package and revert back to version 6.0.0.0.
NOT install Mysql.Data.Entities.EF6 after installing Mysql.Data.Entities!!
Change configuration file so that only one MySql.Data.MySqlClient provider is inside providers and that should have included the version:
&entityFramework&
&defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" /&
&providers&
&provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.5.0, Culture=neutral, PublicKeyToken=cc44d"&&/provider&
&/providers&
I have a similar problem with VS2013 Community, but mine isn't WinForm but ASP.NET MVC. After following all of solutions above and my problems still be there, but they (especially Hamed) gave me some ideas to fix it.
So if you still scroll to here, this might give you also an idea. I have:
Installed MySQL Connector NET 6.8.4 (6.9.5 doesn't seem to work).
Leaved MySQL for VS 1.2.3 as is (no need to install 1.1.1 since 1.2.3 worked).
Installed MySQL.data Mysql.Data.entities from NuGet.
Removed all MySQL.dll from D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies.
Done as Hamed said.
Rebuilt Solution.
Added new ADO.NET Entity Model successfully.
Hope this help.
After struggling for hours during the last 2 days, what finally helped me is to revert all of my code to the old EF5 code, delete the ADO .NET Entity Data Model and re-add it WITHOUT choosing entity framework 6.0 (which was disabled), but choosing 5.0.
Due to the lastest mysql connector, visual studio plugin and all the other stuff that I installed as mentioned above, visual studio automatically added a Entity Framework 6.0 ADO entity data model ignoring my "selection".
I then added all of the references manually in whatever project asked for it (EntityFramework, mysql.data, mysql.data.entity.EF6 ver 6.9.6) and finally it works.
The fix is as follows:
Install MySQL Visual Studio Plugin
Install MySQL Connector for .NET
Add references in project from MySQLConnector Assemblies inside Program Files.
Remove old code from App.Config or Web.Config
&entityFramework&
&defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"&
&parameters&
&parameter value="mssqllocaldb" /&
&/parameters&
&/defaultConnectionFactory&
&providers&
&provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&
&/providers&
&/entityFramework&
Replace with code given below:
&entityFramework&
&defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6"&
&/defaultConnectionFactory&
&providers&
&provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /&
&/providers&
&/entityFramework&
Rebuild the project and try adding new ADO .NET Entity Data Model
I had problems like ih303.
How I fixed it:
-Follow solution V-SHY
-if there are no error messages or anything like that, the wizard just goes away -> do following solution (which worked for me):
instead of putting in:
&entityFramework&
&defaultConnectionFactory type="MySql.Data.Entity.MySqlConnectionFactory, MySql.Data.Entity.EF6" /&
&providers&
&provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /&
&/providers&
&/entityFramework&
change it to following:
&entityFramework&
&defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"&
&parameters&
&parameter value="mssqllocaldb" /&
&/parameters&
&/defaultConnectionFactory&
&providers&
&provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" /&
&provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /&
&/providers&
&/entityFramework&
rebuild -> add wizard and so on -> should work.
For me this seems to have something to do with 32-bit VS 64-bit database drivers.
At least at this point I can switch back and forth between having this error and not having this error by changing my configuration to x64. Trying Any CPU does not work, and trying x86 does not work.
I'm not sure where to decide whether to use 32 or 64 bit MySQL the installer claims to install both.
(I also needed to add one or more of the NuGet packages MySql.Data, MySql.Data.Entity, and MySql.Data.Entities, as well as EntityFramework.)
Once I had the model added to my project I was able to switch the project back to x86 with no problems so far.
5,55242950
The solution that worked for me was first to follow the steps of @V-SHY and install MySql.Data.Entity
3,42793366
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
rev .25952
Stack Overflow works best with JavaScript enabled(window.slotbydup=window.slotbydup || []).push({
id: '2014386',
container: s,
size: '234,60',
display: 'inlay-fix'
&&|&&3次下载&&|&&总70页&&|
您的计算机尚未安装Flash,点击安装&
阅读已结束,如需下载到电脑,请使用积分()
下载:30积分
0人评价7页
0人评价45页
3人评价11页
0人评价13页
0人评价5页
所需积分:(友情提示:大部分文档均可免费预览!下载之前请务必先预览阅读,以免误下载造成积分浪费!)
(多个标签用逗号分隔)
文不对题,内容与标题介绍不符
广告内容或内容过于简单
文档乱码或无法正常显示
若此文档涉嫌侵害了您的权利,请参照说明。
评价文档:
下载:30积分为什么我的代码一直都是WA,求大神指点_ASP.NET技巧_动态网站制作指南
为什么我的代码一直都是WA,求大神指点
来源:人气:17
有N个学生的数据,将学生数据按成绩高低排序,如果成绩相同则按姓名字符的字母序排序,如果姓名的字母序也相同则按照学生的年龄排序,并输出N个学生排序后的信息。
&&& 测试数据有多组,每组输入第一行有一个整数N(N&=1000),接下来的N行包括N个学生的数据。
&&& 每个学生的数据包括姓名(长度不超过100的字符串)、年龄(整形数)、成绩(小于等于100的正数)。
&&& 将学生信息按成绩进行排序,成绩相同的则按姓名的字母序进行排序。
&&& 然后输出学生信息,按照如下格式:
&&& 姓名 年龄 成绩
#include&stdio.h&
#include&stdlib.h&
#include&string.h&
typedef &struct stu{
char name[100];
int cmp(const void *a,const void *b){
Stu *aa = (Stu *)a;
Stu *bb = (Stu *)b;
if(aa-&grade!=bb-&grade) return ((aa-&grade) & (bb-&grade)?1:-1);
c=strcmp(aa-&name,bb-&name);
& & & & if(c!=0)
& & & & & & & &return -c;
& & & &else
& & & &return ((aa-&age) & (bb-&age)?1:-1);
int main(){
int number,i;
& & & & Stu stu[1000];
while(scanf(&%d&,&number)!=EOF){
for(i=0;i&i++){
scanf(&%s %d %d&,stu[i].name,&stu[i].age,&stu[i].grade);
qsort(stu,number,sizeof(stu[0]),cmp);
for(i=0;i&i++){
intf(&%s %d %d\n&,stu[i].name,stu[i].age,stu[i].grade);
& & & & return 0;
优质网站模板

我要回帖

更多关于 microsoft visual2008 的文章

 

随机推荐