Tag Archives: C++ Error

[Solved] C# Error: Could Not Find Net Framework Data ProVider, It may not be installed.

If the problem is reported incorrectly, the screenshot is as above, and the solution is as follows

Step 1: find MySQL in [reference] Version number in data

The second step is on the web Add the following configuration to config

<system.data>
		<DbProviderFactories>
			<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=8.0.24.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
		</DbProviderFactories>
	</system.data>

Note that the version of the above configuration information needs to be changed to the mysql. XML you just viewed Data version number

Then switch to release, regenerate the solution, regenerate the project, and republish.

However, it is strange that I need to delete this configuration information when running locally; This configuration information needs to be added when the server is running

I don’t know why.

C++ Error: Run-Time Check Failure #2 – Stack around the variable ‘cc’ was corrupted.

Run-Time Check Failure #2 – Stack around the variable ‘cc’ was corrupted.

char cc[1024]; // Here, if the index value is set small, there will be a problem. For example: char CC [1]; Is due to the creation of the array subscript overflow caused

 1 // vc2_2_4UDPserver_Txwtech.cpp : Defines the entry point of the console application.
 2 //
 3 #include "StdAfx.h"
 4 #include <WinSock2.h>
 5 #include<stdio.h>
 6 #include<Windows.h>
 7 #pragma comment(lib,"WS2_32.lib")
 8 int main()
 9 {
10     WSADATA data;
11     WORD w=MAKEWORD(2,0);
12     char sztext[]="WELCOME\r\n";
13     ::WSAStartup(w,&data);
14     SOCKET s;
15     s=::socket(AF_INET, SOCK_DGRAM,0);
16     sockaddr_in addr,addr2;
17     int n=sizeof(addr2);
18     char buff[10]={0};
19     addr.sin_family=AF_INET;
20     addr.sin_port=htons(75);
21     addr.sin_addr.S_un.S_addr=INADDR_ANY;
22     ::bind(s,(sockaddr*)&addr,sizeof(addr));
23     printf("The UDP server has started \r\n");
24 while(1)
25 {
26 char cc[1024]; // Here, if the index value is set small, something will go wrong. For example: char cc[1]; is caused by an overflow of the subscript of the array created
27             //c=getchar();
28     //    c='';
29         printf("PLEASE INPUT C:");
30         scanf("%s",cc);
31         //sztext=c;
32     //    strcpy(sztext,c);
33         if (strcmp(cc,"qq")==0)
34 
35             {
36                 printf("EXIT %s",cc);
37                 ::Sleep(1000);
38                 ::closesocket(s);
39                 ::WSACleanup();
40             //    strcpy(cc,"");
41                 return 0;
42             }
43         if(::recvfrom(s,buff,10,0,(sockaddr*)&addr2,&n)!=0)
44         {
45             printf("%sCONTEECTED \r\n",inet_ntoa(addr2.sin_addr));
46             printf("%s\r\n",buff);
47             
48             
49             ::sendto(s,sztext,sizeof(sztext),0,(sockaddr*)&addr2,n);
50         //    break;
51         }
52         
53     }
54     ::closesocket(s);
55     ::WSACleanup();
56     
57     if(getchar())
58     {
59         return 0;
60         //::sendto(s,sztext,sizeof(sztext),0,(sockaddr*)&addr2,n);
61     }
62     else
63     {
64         ::Sleep(100);
65     }
66 }

C++ Error: passing ” “as” ” discards qualifiers

Today, I wrote a small piece of code. I thought it was correct, but after running it, it was somehow “discard qualifier”“

Here is the original program:

#include< iostream>

using namespace std;

class Date

{

int year;

public:

Date(int y):year(y){}

int get_ year()

{

return year;

}

int plus(const Date& p)

{

int total = p.get_ year()+year;

return total;

}

};

int main()

{

Date q(1000);

Date p(2000);

cout<& lt; p.plus(q);

system(“pause”);

}

Passing ` const date ‘as ` this’ argument of ` int date:: get_ What do you mean by year ()’discards qualifiers?Original const date & amp; p. The compiler decides to call const member function, that is, it can’t modify the member value of P call_ Year, just read, no modify?In principle, there is no modify, but the C + + compiler always assumes that you can modify the value. In fact, it can modify the value, so it is inconsistent with const member function. How can I change the two methods. First, remove const. Second, in get_ Add const after year

 

#include< iostream>

using namespace std;

class Date

{

int year;

public:

Date(int y):year(y){}

int get_ year()

{

return year;

}

int plus(const Date& p)const

{

int total = p.get_ year()+year;

return total;

}

};

int main()

{

Date q(1000);

Date p(2000);

cout<& lt; p.plus(q);

system(“pause”);

}

That’s right.

The above is just a little thinking for beginners, for your reference~~~