delphi could not convert variant of type (null) into type (olestr)

procedure TForm3.DBEdit1Change(Sender: TObject); //onchange事件
var
i:integer;
s:string;
xcom:tcomponent;
begin
for i := 2 to 20 do
begin
s:='edit'+inttostr(i);
xcom:=findcomponent(s);
if xcom<>nil then
begin
Tedit(xcom).Text:=ADOquery1.Fields[i-2].Value; //break 按了之后这一条被选中了。错了么?
end;

procedure TForm3.FormShow(Sender: TObject);
begin

ADOConnection1.Connected:=false; //连接,设置。
ADOConnection1.Connected:=true;

ADOQuery1.Connection:=adoconnection1;
ADOQuery1.SQL.Clear;
ADOQuery1.Close;
ADOQuery1.SQL.Text:='select CustomerID,pyCode,CustomerName,ProvinceID,CityID,Address,Zip,Phone,Fax,Email,HomePage,Industry,Type,Source,Status,Revenue,employees,owner,StockNo,Notes from customers';
ADOQuery1.Open;
DataSource1.DataSet:=adoquery1;

ADOtable1.Close;
ADOtable1.Connection:=ADOConnection1; //连接adotable后做的事情
ADOtable1.tablename:='customers';
ADOtable1.Open;

dbnavigator1.DataSource:=DataSource1;
dbgrid1.DataSource:=DataSource1;

edit1.Text:='';
f(); //外观设置的函数调用

procedure TForm3.ToolButton5Click(Sender: TObject); //刷新按钮
begin
adoquery1.Close;
adoquery1.Open;
f();
end;

我能写的都写了,但是刷新按钮还是错,错误提示如题。
我什么都不做,运行先按刷新还是出现同样的错误。
我不知道我sql语句哪里被修改了?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Su-domino-ku 程序怎么写
Problem Description As if there were not already enough sudoku-like puzzles, the July 2009 issue of Games Magazine describes the following variant that combines facets of both sudoku and dominos. The puzzle is a form of a standard sudoku, in which there is a nine-by-nine grid that must be filled in using only digits 1 through 9. In a successful solution: Each row must contain each of the digits 1 through 9. Each column must contain each of the digits 1 through 9. Each of the indicated three-by-three squares must contain each of the digits 1 through 9. For a su-domino-ku, nine arbitrary cells are initialized with the numbers 1 to 9. This leaves 72 remaining cells. Those must be filled by making use of the following set of 36 domino tiles. The tile set includes one domino for each possible pair of unique numbers from 1 to 9 (e.g., 1+2, 1+3, 1+4, 1+5, 1+6, 1+7, 1+8, 1+9, 2+3, 2+4, 2+5, ...). Note well that there are not separate 1+2 and 2+1 tiles in the set; the single such domino can be rotated to provide either orientation. Also, note that dominos may cross the boundary of the three-by-three squares (as does the 2+9 domino in our coming example). To help you out, we will begin each puzzle by identifying the location of some of the dominos. For example, Figure 1 shows a sample puzzle in its initial state. Figure 2 shows the unique way to complete that puzzle. Input Each puzzle description begins with a line containing an integer N, for 10 ≤ N ≤ 35, representing the number of dominos that are initially placed in the starting configuration. Following that are N lines, each describing a single domino as U LU V LV. Value U is one of the numbers on the domino, and LU is a two-character string representing the location of value U on the board based on the grid system diagrammed in Figure 1. The variables V and LV representing the respective value and location of the other half of the domino. For example, our first sample input beings with a domino described as 6 B2 1 B3. This corresponds to the domino with values 6+1 being placed on the board such that value 6 is in row B, column 2 and value 1 in row B, column 3. The two locations for a given domino will always be neighboring. After the specification of the N dominos will be a final line that describes the initial locations of the isolated numbers, ordered from 1 to 9, using the same row-column conventions for describing locations on the board. All initial numbers and dominos will be at unique locations. The input file ends with a line containing 0. Output For each puzzle, output an initial line identifying the puzzle number, as shown below. Following that, output the 9x9 sudoku board that can be formed with the set of dominos. There will be a unique solution for each puzzle. Sample Input 10 6 B2 1 B3 2 C4 9 C3 6 D3 8 E3 7 E1 4 F1 8 B7 4 B8 3 F5 2 F6 7 F7 6 F8 5 G4 9 G5 7 I8 8 I9 7 C9 2 B9 C5 A3 D9 I4 A9 E5 A2 C6 I1 11 5 I9 2 H9 6 A5 7 A6 4 B8 6 C8 3 B5 8 B4 3 C3 2 D3 9 D2 8 E2 3 G2 5 H2 1 A2 8 A1 1 H8 3 I8 8 I3 7 I4 4 I6 9 I7 I5 E6 D1 F2 B3 G9 H7 C9 E5 0 Sample Output Puzzle 1 872643195 361975842 549218637 126754983 738169254 495832761 284597316 657381429 913426578 Puzzle 2 814267593 965831247 273945168 392176854 586492371 741358629 137529486 459683712 628714935
TeeChart控件中函数AddArray所需数据类型VARIANT能否实现快速的数据复制?
AddArray函数的输入参数类型为VARIANT,当下次绘图需要的部分数据为前一次绘图时使用的数据时,能否实现部分数据的直接块复制,如果按照常规的逐点复制效率略低,需要的运行时间较长?
Su-domino-ku 数独问题
Problem Description As if there were not already enough sudoku-like puzzles, the July 2009 issue of Games Magazine describes the following variant that combines facets of both sudoku and dominos. The puzzle is a form of a standard sudoku, in which there is a nine-by-nine grid that must be filled in using only digits 1 through 9. In a successful solution: Each row must contain each of the digits 1 through 9. Each column must contain each of the digits 1 through 9. Each of the indicated three-by-three squares must contain each of the digits 1 through 9. For a su-domino-ku, nine arbitrary cells are initialized with the numbers 1 to 9. This leaves 72 remaining cells. Those must be filled by making use of the following set of 36 domino tiles. The tile set includes one domino for each possible pair of unique numbers from 1 to 9 (e.g., 1+2, 1+3, 1+4, 1+5, 1+6, 1+7, 1+8, 1+9, 2+3, 2+4, 2+5, ...). Note well that there are not separate 1+2 and 2+1 tiles in the set; the single such domino can be rotated to provide either orientation. Also, note that dominos may cross the boundary of the three-by-three squares (as does the 2+9 domino in our coming example). To help you out, we will begin each puzzle by identifying the location of some of the dominos. For example, Figure 1 shows a sample puzzle in its initial state. Figure 2 shows the unique way to complete that puzzle. Input Each puzzle description begins with a line containing an integer N, for 10 ≤ N ≤ 35, representing the number of dominos that are initially placed in the starting configuration. Following that are N lines, each describing a single domino as U LU V LV. Value U is one of the numbers on the domino, and LU is a two-character string representing the location of value U on the board based on the grid system diagrammed in Figure 1. The variables V and LV representing the respective value and location of the other half of the domino. For example, our first sample input beings with a domino described as 6 B2 1 B3. This corresponds to the domino with values 6+1 being placed on the board such that value 6 is in row B, column 2 and value 1 in row B, column 3. The two locations for a given domino will always be neighboring. After the specification of the N dominos will be a final line that describes the initial locations of the isolated numbers, ordered from 1 to 9, using the same row-column conventions for describing locations on the board. All initial numbers and dominos will be at unique locations. The input file ends with a line containing 0. Output For each puzzle, output an initial line identifying the puzzle number, as shown below. Following that, output the 9x9 sudoku board that can be formed with the set of dominos. There will be a unique solution for each puzzle. Sample Input 10 6 B2 1 B3 2 C4 9 C3 6 D3 8 E3 7 E1 4 F1 8 B7 4 B8 3 F5 2 F6 7 F7 6 F8 5 G4 9 G5 7 I8 8 I9 7 C9 2 B9 C5 A3 D9 I4 A9 E5 A2 C6 I1 11 5 I9 2 H9 6 A5 7 A6 4 B8 6 C8 3 B5 8 B4 3 C3 2 D3 9 D2 8 E2 3 G2 5 H2 1 A2 8 A1 1 H8 3 I8 8 I3 7 I4 4 I6 9 I7 I5 E6 D1 F2 B3 G9 H7 C9 E5 0 Sample Output Puzzle 1 872643195 361975842 549218637 126754983 738169254 495832761 284597316 657381429 913426578 Puzzle 2 814267593 965831247 273945168 392176854 586492371 741358629 137529486 459683712 628714935
Su-domino-ku 的具体代码
Problem Description As if there were not already enough sudoku-like puzzles, the July 2009 issue of Games Magazine describes the following variant that combines facets of both sudoku and dominos. The puzzle is a form of a standard sudoku, in which there is a nine-by-nine grid that must be filled in using only digits 1 through 9. In a successful solution: Each row must contain each of the digits 1 through 9. Each column must contain each of the digits 1 through 9. Each of the indicated three-by-three squares must contain each of the digits 1 through 9. For a su-domino-ku, nine arbitrary cells are initialized with the numbers 1 to 9. This leaves 72 remaining cells. Those must be filled by making use of the following set of 36 domino tiles. The tile set includes one domino for each possible pair of unique numbers from 1 to 9 (e.g., 1+2, 1+3, 1+4, 1+5, 1+6, 1+7, 1+8, 1+9, 2+3, 2+4, 2+5, ...). Note well that there are not separate 1+2 and 2+1 tiles in the set; the single such domino can be rotated to provide either orientation. Also, note that dominos may cross the boundary of the three-by-three squares (as does the 2+9 domino in our coming example). To help you out, we will begin each puzzle by identifying the location of some of the dominos. For example, Figure 1 shows a sample puzzle in its initial state. Figure 2 shows the unique way to complete that puzzle. Input Each puzzle description begins with a line containing an integer N, for 10 ≤ N ≤ 35, representing the number of dominos that are initially placed in the starting configuration. Following that are N lines, each describing a single domino as U LU V LV. Value U is one of the numbers on the domino, and LU is a two-character string representing the location of value U on the board based on the grid system diagrammed in Figure 1. The variables V and LV representing the respective value and location of the other half of the domino. For example, our first sample input beings with a domino described as 6 B2 1 B3. This corresponds to the domino with values 6+1 being placed on the board such that value 6 is in row B, column 2 and value 1 in row B, column 3. The two locations for a given domino will always be neighboring. After the specification of the N dominos will be a final line that describes the initial locations of the isolated numbers, ordered from 1 to 9, using the same row-column conventions for describing locations on the board. All initial numbers and dominos will be at unique locations. The input file ends with a line containing 0. Output For each puzzle, output an initial line identifying the puzzle number, as shown below. Following that, output the 9x9 sudoku board that can be formed with the set of dominos. There will be a unique solution for each puzzle. Sample Input 10 6 B2 1 B3 2 C4 9 C3 6 D3 8 E3 7 E1 4 F1 8 B7 4 B8 3 F5 2 F6 7 F7 6 F8 5 G4 9 G5 7 I8 8 I9 7 C9 2 B9 C5 A3 D9 I4 A9 E5 A2 C6 I1 11 5 I9 2 H9 6 A5 7 A6 4 B8 6 C8 3 B5 8 B4 3 C3 2 D3 9 D2 8 E2 3 G2 5 H2 1 A2 8 A1 1 H8 3 I8 8 I3 7 I4 4 I6 9 I7 I5 E6 D1 F2 B3 G9 H7 C9 E5 0 Sample Output Puzzle 1 872643195 361975842 549218637 126754983 738169254 495832761 284597316 657381429 913426578 Puzzle 2 814267593 965831247 273945168 392176854 586492371 741358629 137529486 459683712 628714935
Su-domino-ku 是怎么来写的
Problem Description As if there were not already enough sudoku-like puzzles, the July 2009 issue of Games Magazine describes the following variant that combines facets of both sudoku and dominos. The puzzle is a form of a standard sudoku, in which there is a nine-by-nine grid that must be filled in using only digits 1 through 9. In a successful solution: Each row must contain each of the digits 1 through 9. Each column must contain each of the digits 1 through 9. Each of the indicated three-by-three squares must contain each of the digits 1 through 9. For a su-domino-ku, nine arbitrary cells are initialized with the numbers 1 to 9. This leaves 72 remaining cells. Those must be filled by making use of the following set of 36 domino tiles. The tile set includes one domino for each possible pair of unique numbers from 1 to 9 (e.g., 1+2, 1+3, 1+4, 1+5, 1+6, 1+7, 1+8, 1+9, 2+3, 2+4, 2+5, ...). Note well that there are not separate 1+2 and 2+1 tiles in the set; the single such domino can be rotated to provide either orientation. Also, note that dominos may cross the boundary of the three-by-three squares (as does the 2+9 domino in our coming example). To help you out, we will begin each puzzle by identifying the location of some of the dominos. For example, Figure 1 shows a sample puzzle in its initial state. Figure 2 shows the unique way to complete that puzzle. Input Each puzzle description begins with a line containing an integer N, for 10 ≤ N ≤ 35, representing the number of dominos that are initially placed in the starting configuration. Following that are N lines, each describing a single domino as U LU V LV. Value U is one of the numbers on the domino, and LU is a two-character string representing the location of value U on the board based on the grid system diagrammed in Figure 1. The variables V and LV representing the respective value and location of the other half of the domino. For example, our first sample input beings with a domino described as 6 B2 1 B3. This corresponds to the domino with values 6+1 being placed on the board such that value 6 is in row B, column 2 and value 1 in row B, column 3. The two locations for a given domino will always be neighboring. After the specification of the N dominos will be a final line that describes the initial locations of the isolated numbers, ordered from 1 to 9, using the same row-column conventions for describing locations on the board. All initial numbers and dominos will be at unique locations. The input file ends with a line containing 0. Output For each puzzle, output an initial line identifying the puzzle number, as shown below. Following that, output the 9x9 sudoku board that can be formed with the set of dominos. There will be a unique solution for each puzzle. Sample Input 10 6 B2 1 B3 2 C4 9 C3 6 D3 8 E3 7 E1 4 F1 8 B7 4 B8 3 F5 2 F6 7 F7 6 F8 5 G4 9 G5 7 I8 8 I9 7 C9 2 B9 C5 A3 D9 I4 A9 E5 A2 C6 I1 11 5 I9 2 H9 6 A5 7 A6 4 B8 6 C8 3 B5 8 B4 3 C3 2 D3 9 D2 8 E2 3 G2 5 H2 1 A2 8 A1 1 H8 3 I8 8 I3 7 I4 4 I6 9 I7 I5 E6 D1 F2 B3 G9 H7 C9 E5 0 Sample Output Puzzle 1 872643195 361975842 549218637 126754983 738169254 495832761 284597316 657381429 913426578 Puzzle 2 814267593 965831247 273945168 392176854 586492371 741358629 137529486 459683712 628714935
vs2010 mfc ADO连接SQL server 程序不解
![图片说明](https://img-ask.csdn.net/upload/202001/23/1579746010_73671.jpg) 各位网友, 我在网站下载的一个MFC ADO方式连接SQL server数据库代码有个地方不明白,请帮忙看看 新建一个按钮,加入如下代码: void CADOTESTDlg::OnBnClickedButton2() { // TODO: 在此添加控件通知处理程序代码 1. ADOConn conn; 2. conn.OnInitADOConn(); 3. _bstr_t vSQL; 4. vSQL = "INSERT INTO [dbtest].[dbo].[userinfo] ([username],[userpwd]) VALUES('seamanj','123')"; 5. conn.ExecuteSQL(vSQL); 6. conn.ExitConnect(); 7. conn.m_pConnection; } MFC 中debug执行完第2行,m_pConnection中就有了地址,SQL server 中执行Select * from sys.dm_exec_connections可看到新的连接,但是执行完第6行应该m_pConnection中的地址被清空,并且断开连接的,可是实际情况是一直到执行完所有的代码并结束,m_pConnection才被清空并断开连接。 哪位能帮我解释下,谢谢。 ``` void ADOConn::ExitConnect() { // 关闭记录集和连接 if (m_pRecordset != NULL) m_pRecordset->Close(); m_pConnection->Close(); // 释放环境 ::CoUninitialize(); //CString temp=_T("0"); } ``` ``` void ADOConn::OnInitADOConn() { // 初始化OLE/COM库环境 //CoInitialize(NULL)和AfxOleInit()的区别: https://blog.csdn.net/zhoubl668/article/details/4139933 ::CoInitialize(NULL); try { // 创建Connection对象 m_pConnection.CreateInstance("ADODB.Connection"); // 设置连接字符串,必须是BSTR型或者_bstr_t类型 _bstr_t strConnect = "Provider=SQLOLEDB; Server=127.0.0.1;Database=dbtest; uid=lnhv013710; pwd=013710;"; m_pConnection->Open(strConnect,"","",adModeUnknown); } // 捕捉异常 catch(_com_error e) { // 显示错误信息 AfxMessageBox(e.Description()); } } ``` ``` #pragma once class ADOConn { // 定义变量 public: //添加一个指向Connection对象的指针: _ConnectionPtr m_pConnection; //添加一个指向Recordset对象的指针: _RecordsetPtr m_pRecordset; // 定义方法 public: ADOConn(); virtual ~ADOConn(); // 初始化—连接数据库 void OnInitADOConn(); // 执行查询 _RecordsetPtr& GetRecordSet(_bstr_t bstrSQL); // 执行SQL语句,Insert Update _variant_t BOOL ExecuteSQL(_bstr_t bstrSQL); void ExitConnect(); }; ```
access数据库,0xC0000005: 读取位置 0xe38e38e4 时发生访问冲突
void CdatabaseDlg::OnBnClickedSelect() { // TODO: 在此添加控件通知处理程序代码 int i = 0; // m_list.DeleteAllItems(); cmd.OnInitDialog(); UpdateData(true); // CRect rect; // 获取编程语言列表视图控件的位置和大小 // m_list.GetClientRect(&rect); // 为列表视图控件添加全行选中和栅格风格 // m_list.SetExtendedStyle(m_list.GetExtendedStyle() | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES); // m_list.InsertColumn(0, _T("城市"), LVCFMT_LEFT, rect.Width() / 3); // m_list.InsertColumn(1, _T("区县"), LVCFMT_LEFT, rect.Width() / 3); // m_list.InsertColumn(2, _T("邮编"), LVCFMT_LEFT, rect.Width() / 3); { try { _variant_t RecordsAffected; cmd.m_pRecordset.CreateInstance(__uuidof(Recordset));//初始化Recordset指针 CString search_sql; search_sql = "SELECT * FROM 监视和测量设备"; cmd.m_pRecordset = cmd.m_pConnection->Execute(search_sql.AllocSysString(), NULL, adCmdText); while (!cmd.m_pRecordset->adoEOF) { CString name,department,user,category,number,number1,model,number2,category1,importance,oldpany; CString newpany,cost,date,date1,date2,number3,factory,test,grade,result,state,state1,no,information,date3; // CString chooseid; // CString choosevalue; name = cmd.m_pRecordset->GetCollect("name").bstrVal; m_list.InsertItem(i, name); department = cmd.m_pRecordset->GetCollect("part").bstrVal; m_list.SetItemText(i, 1, department); user = cmd.m_pRecordset->GetCollect("user").bstrVal; m_list.SetItemText(i, 2, user); category = cmd.m_pRecordset->GetCollect("category").bstrVal; m_list.SetItemText(i, 3, category); number = cmd.m_pRecordset->GetCollect("number").bstrVal; m_list.SetItemText(i, 4, number); number1 = cmd.m_pRecordset->GetCollect("number1").bstrVal; m_list.SetItemText(i, 5, number1); model = cmd.m_pRecordset->GetCollect("model").bstrVal; m_list.SetItemText(i, 6, model); number2 = cmd.m_pRecordset->GetCollect("number2").bstrVal; m_list.SetItemText(i, 7, number2); category1 = cmd.m_pRecordset->GetCollect("category1").bstrVal; m_list.SetItemText(i, 8, category1); importance = cmd.m_pRecordset->GetCollect("importance").bstrVal; m_list.SetItemText(i, 9, importance); oldpany = cmd.m_pRecordset->GetCollect("oldpany").bstrVal; m_list.SetItemText(i, 10, oldpany); newpany = cmd.m_pRecordset->GetCollect("newpany").bstrVal; m_list.SetItemText(i, 11, newpany); cost = cmd.m_pRecordset->GetCollect("cost").bstrVal; m_list.SetItemText(i, 12, cost); date = cmd.m_pRecordset->GetCollect("date").bstrVal; m_list.SetItemText(i, 13, date); date1 = cmd.m_pRecordset->GetCollect("date1").bstrVal; m_list.SetItemText(i, 14, date1); date2 = cmd.m_pRecordset->GetCollect("date2").bstrVal; m_list.SetItemText(i, 15, date2); number3 = cmd.m_pRecordset->GetCollect("number3").bstrVal; m_list.SetItemText(i, 16, number3); factory = cmd.m_pRecordset->GetCollect("factory").bstrVal; m_list.SetItemText(i, 17, factory); test = cmd.m_pRecordset->GetCollect("test").bstrVal; m_list.SetItemText(i, 18, test); grade = cmd.m_pRecordset->GetCollect("grade").bstrVal; m_list.SetItemText(i, 19, grade); result = cmd.m_pRecordset->GetCollect("result").bstrVal; m_list.SetItemText(i, 20, result); state = cmd.m_pRecordset->GetCollect("state").bstrVal; m_list.SetItemText(i, 21, state); state1 = cmd.m_pRecordset->GetCollect("state1").bstrVal; m_list.SetItemText(i, 22, state1); no = cmd.m_pRecordset->GetCollect("no").bstrVal; m_list.SetItemText(i, 23, no); information = cmd.m_pRecordset->GetCollect("information").bstrVal; m_list.SetItemText(i, 24, information); date3 = cmd.m_pRecordset->GetCollect("date3").bstrVal; m_list.SetItemText(i, 25, date3); cmd.m_pRecordset->MoveNext(); i++; } cmd.m_pRecordset->Close(); } catch (_com_error e) { AfxMessageBox(_T("搜索失败!")); return; } } } 执行到这date3 = cmd.m__pRecordset->GetCollect("date3").bstrVal; 再往下执行就报错,求大神指导,小白初学者
In Danger 怎么才能具体实现的
Description Flavius Josephus and 40 fellow rebels were trapped by the Romans. His companions preferred suicide to surrender, so they decided to form a circle and to kill every third person and to proceed around the circle until no one was left. Josephus was not excited by the idea of killing himself, so he calculated the position to be the last man standing (and then he did not commit suicide since nobody could watch). We will consider a variant of this "game" where every second person leaves. And of course there will be more than 41 persons, for we now have computers. You have to calculate the safe position. Be careful because we might apply your program to calculate the winner of this contest! Input The input contains several test cases. Each specifies a number n, denoting the number of persons participating in the game. To make things more difficult, it always has the format "xyez" with the following semantics: when n is written down in decimal notation, its first digit is x, its second digit is y, and then follow z zeros. Whereas 0<=x,y<=9, the number of zeros is 0<=z<=6. You may assume that n>0. The last test case is followed by the string 00e0. Output For each test case generate a line containing the position of the person who survives. Assume that the participants have serial numbers from 1 to n and that the counting starts with person 1, i.e., the first person leaving is the one with number 2. For example, if there are 5 persons in the circle, counting proceeds as 2, 4, 1, 5 and person 3 is staying alive. Sample Input 05e0 01e1 42e0 66e6 00e0 Sample Output 3 5 21 64891137
安卓开发JDBC连接数据库No static method metafactory错误怎么解决?
直接上代码 JdbcUtil类 ``` package com.example.myapplication; import java.io.File; import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties; public class JdbcUtil { private static JdbcUtil instance; public static JdbcUtil getInstance(){ if (instance ==null){ instance = new JdbcUtil(); } return instance; } public Connection getConnection(String dbName,String name,String password) { try { new com.mysql.cj.jdbc.Driver(); String url = "jdbc:mysql://localhost:3306/"+dbName; return DriverManager.getConnection(url,name,password); } catch (Exception e) { return null; } } public Connection getConnection(String file){ File f = new File(file); if(!f.exists()){ return null; }else { Properties pro = new Properties(); try { Class.forName("com.mysql.jdbc.Driver"); pro.load(new FileInputStream(f)); String url = pro.getProperty("url"); String name = pro.getProperty("name"); String password = pro.getProperty("password"); return DriverManager.getConnection(url,name,password); }catch (Exception e){ return null; } } } } ``` UserDao类 ``` package com.example.myapplication; import android.util.Log; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import static android.content.ContentValues.TAG; public class UserDao { JdbcUtil jdbcUtil = JdbcUtil.getInstance(); //第一个参数为数据库名称,第二个参数为数据库账号 第三个参数为数据库密码 Connection conn = jdbcUtil.getConnection("test","root","LHMbdbqandr2015"); //注册 public boolean register(String name,String password){ if (conn==null){ Log.i(TAG,"register:conn is null"); return false; }else { //进行数据库操作 String sql = "insert into user(name,password) values(?,?)"; try { PreparedStatement pre = conn.prepareStatement(sql); pre.setString(1,name); pre.setString(2,password); return pre.execute(); } catch (SQLException e) { return false; }finally { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } } //登录 public boolean login(String name,String password){ if (conn==null){ Log.i(TAG,"register:conn is null"); return false; }else { String sql = "select * from user where name=? and password=?"; try { PreparedStatement pres = conn.prepareStatement(sql); pres.setString(1,name); pres.setString(2,password); ResultSet res = pres.executeQuery(); boolean t = res.next(); return t; } catch (SQLException e) { return false; } } } } ``` MainActivity文件 ``` package com.example.myapplication; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Looper; import android.os.Trace; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { private static final String TAG="MainActivity"; private EditText name; private EditText password; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name = findViewById(R.id.name); password = findViewById(R.id.password); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (checkSelfPermission(Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // Activity#requestPermissions requestPermissions(new String[]{Manifest.permission.INTERNET},1); // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for Activity#requestPermissions for more details. return; } } } //用户根据点击事件来找到相应的功能 public void fun(View v){ switch (v.getId()){ case R.id.register: new Thread(new Runnable() { @Override public void run() { String n = name.getText().toString().trim(); String psw = password.getText().toString().trim(); UserDao ud = new UserDao(); boolean result =ud.register(n,psw); if (!result){ Looper.prepare(); Toast toast = Toast.makeText(MainActivity.this,"注册成功!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); } Log.i(TAG,"fun"+result); //以上为jdbc注册 } }).start(); break; case R.id.login: new Thread(new Runnable() { @Override public void run() { String n = name.getText().toString().trim(); String psw = password.getText().toString().trim(); if (n.equals("")||psw.equals("")){ Looper.prepare(); Toast toast = Toast.makeText(MainActivity.this,"输入不能为空!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); } UserDao ud = new UserDao(); Boolean result = ud.login(n,psw); if (!result){ Looper.prepare(); Toast toast=Toast.makeText(MainActivity.this,"用户名不存在或密码错误!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); }else{ Looper.prepare(); Toast toast=Toast.makeText(MainActivity.this,"登录成功",Toast.LENGTH_SHORT); toast.show(); //一下代码为跳转界面 // Intent intent=new Intent(MainActivity.this,info.class); //intent.putExtra("name",n); // startActivity(intent); Looper.loop(); } //以上为jdbc登录 } }).start(); } } } ``` 现在遇到的问题如下 ``` 11/14 01:40:49: Launching 'app' on Nexus 5X API 29 x86. $ adb shell am start -n "com.example.myapplication/com.example.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Waiting for process to come online... Connected to process 23852 on device 'emulator-5554'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. I/e.myapplicatio: Not late-enabling -Xcheck:jni (already on) E/e.myapplicatio: Unknown bits set in runtime_flags: 0x8000 W/e.myapplicatio: Unexpected CPU variant for X86 using defaults: x86 D/libEGL: Emulator has host GPU support, qemu.gles is set to 1. W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied) W/RenderThread: type=1400 audit(0.0:129): avc: denied { write } for name="property_service" dev="tmpfs" ino=8368 scontext=u:r:untrusted_app:s0:c130,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.example.myapplication D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so W/e.myapplicatio: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) D/: HostConnection::get() New Host Connection established 0xd7d24f50, tid 23910 D/: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1 W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0 D/EGL_emulation: eglCreateContext: 0xe3340b60: maj 3 min 1 rcv 4 D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da glUtilsParamSize: unknow param 0x000082da W/Gralloc3: mapper 3.x is not supported D/: createUnique: call D/: HostConnection::get() New Host Connection established 0xd7d26ad0, tid 23910 HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1 D/eglCodecCommon: allocate: Ask for block of size 0x1000 D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3ffff6000 size 0x2000 D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0 I/AssistStructure: Flattened final assist data: 1788 bytes, containing 1 windows, 10 views W/e.myapplicatio: Accessing hidden method Ljava/lang/invoke/LambdaMetafactory;->metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; (blacklist, linking, denied) E/AndroidRuntime: FATAL EXCEPTION: Thread-2 Process: com.example.myapplication, PID: 23852 java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar) at com.mysql.cj.conf.ConnectionUrl.buildConnectionStringCacheKey(ConnectionUrl.java:246) at com.mysql.cj.conf.ConnectionUrl.getConnectionUrlInstance(ConnectionUrl.java:185) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:204) at java.sql.DriverManager.getConnection(DriverManager.java:580) at java.sql.DriverManager.getConnection(DriverManager.java:218) at com.example.myapplication.JdbcUtil.getConnection(JdbcUtil.java:22) at com.example.myapplication.UserDao.<init>(UserDao.java:15) at com.example.myapplication.MainActivity$1.run(MainActivity.java:53) at java.lang.Thread.run(Thread.java:919) D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) D/AutofillManager: onActivityFinishing(): calling cancelLocked() Process 23852 terminated. ``` 在网上百度了很多方法都没有解决,起初以为是驱动的问题,但是换了一个仍然不好用,求求大神赐教
Videopoker 的问题的解答.
Problem Description Videopoker is the slot machine variant of the currently immensely popular game of poker. It is a variant on draw poker. In this game the player gets a hand consisting of five cards randomly drawn from a standard 52-card deck. From this hand, the player may discard any number of cards (between 0 and 5, inclusive), and change them for new cards randomly drawn from the remainder of the deck. After that, the hand is evaluated and the player is rewarded according to a payout structure. A common payout structure is as follows: Once you know the payout structure, you can determine for a given hand which cards you must change to maximize your expected reward. We'd like to know this expected reward, given a hand. Input On the first line one positive number: the number of testcases, at most 100. After that per testcase: * One line with nine integers xi (0 ≤ xi ≤ 1000$) describing the payout structure. The numbers are in increasing order and describe the payout for one pair, two pair, etc, until the royal flush. * One line with one integer n (1 ≤ n ≤ 10): the number of starting hands to follow. * n lines, each describing a starting hand. A hand consists of five space separated tokens of the form Xs, with X being the rank (`2'...`9', `T', `J', `Q', `K' or `A') and s being the suit (`c', `d', `h' or `s'). Output Per testcase: * One line for each starting hand with a floating point number that is the maximal expected reward for that hand. These numbers must have an absolute or relative error less than 10-6. Sample Input 1 1 2 3 4 5 10 25 100 250 5 Ah Ac Ad As 2s Ks Qs Js Ts 2h Ks Qs 2d 2h 3s 2d 4h 5d 3c 9c 2h 3h 6d 8h Tc Sample Output 25.000000 8.9574468 1.5467160 0.9361702 0.6608135
Videopoker 的问题的极大
Problem Description Videopoker is the slot machine variant of the currently immensely popular game of poker. It is a variant on draw poker. In this game the player gets a hand consisting of five cards randomly drawn from a standard 52-card deck. From this hand, the player may discard any number of cards (between 0 and 5, inclusive), and change them for new cards randomly drawn from the remainder of the deck. After that, the hand is evaluated and the player is rewarded according to a payout structure. A common payout structure is as follows: Once you know the payout structure, you can determine for a given hand which cards you must change to maximize your expected reward. We'd like to know this expected reward, given a hand. Input On the first line one positive number: the number of testcases, at most 100. After that per testcase: * One line with nine integers xi (0 ≤ xi ≤ 1000$) describing the payout structure. The numbers are in increasing order and describe the payout for one pair, two pair, etc, until the royal flush. * One line with one integer n (1 ≤ n ≤ 10): the number of starting hands to follow. * n lines, each describing a starting hand. A hand consists of five space separated tokens of the form Xs, with X being the rank (`2'...`9', `T', `J', `Q', `K' or `A') and s being the suit (`c', `d', `h' or `s'). Output Per testcase: * One line for each starting hand with a floating point number that is the maximal expected reward for that hand. These numbers must have an absolute or relative error less than 10-6. Sample Input 1 1 2 3 4 5 10 25 100 250 5 Ah Ac Ad As 2s Ks Qs Js Ts 2h Ks Qs 2d 2h 3s 2d 4h 5d 3c 9c 2h 3h 6d 8h Tc Sample Output 25.000000 8.9574468 1.5467160 0.9361702 0.6608135
notification无法显示
按照第一行代码打的notification,不知道那里错了(水平太低),系统是ubuntu ``` package com.example.unit_8; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import android.app.Notification; import android.app.NotificationManager; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity implements View.OnClickListener{ private Button Send_notice; private NotificationManager notificationManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Send_notice = (Button) findViewById(R.id.send_notice); Send_notice.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.send_notice: notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); Notification notification = new NotificationCompat.Builder(this,"default") .setContentTitle("this is title") .setContentText("this is text") .setSmallIcon(R.mipmap.ic_launcher).build(); notificationManager.notify(1,notification); Log.i("msg","R.id.send_notice"); break; default: break; } } } ``` ``` ``` ``` 这个是log信息 2019-10-13 17:07:18.253 28995-28995/? I/.example.unit_: Not late-enabling -Xcheck:jni (already on) 2019-10-13 17:07:18.283 28995-28995/? E/.example.unit_: Unknown bits set in runtime_flags: 0x8000 2019-10-13 17:07:18.288 28995-28995/? W/.example.unit_: Unexpected CPU variant for X86 using defaults: x86 2019-10-13 17:07:18.497 28995-28995/com.example.unit_8 W/.example.unit_: JIT profile information will not be recorded: profile file does not exits. 2019-10-13 17:07:18.498 28995-28995/com.example.unit_8 I/chatty: uid=10142(com.example.unit_8) identical 10 lines 2019-10-13 17:07:18.498 28995-28995/com.example.unit_8 W/.example.unit_: JIT profile information will not be recorded: profile file does not exits. 2019-10-13 17:07:18.504 28995-28995/com.example.unit_8 I/InstantRun: starting instant run server: is main process 2019-10-13 17:07:18.523 28995-28995/com.example.unit_8 W/RenderThread: type=1400 audit(0.0:186): avc: denied { write } for name="property_service" dev="tmpfs" ino=7189 scontext=u:r:untrusted_app:s0:c142,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 2019-10-13 17:07:18.540 28995-29016/com.example.unit_8 D/libEGL: Emulator has host GPU support, qemu.gles is set to 1. 2019-10-13 17:07:18.541 28995-29016/com.example.unit_8 W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied) 2019-10-13 17:07:18.603 28995-29016/com.example.unit_8 D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so 2019-10-13 17:07:18.604 28995-29016/com.example.unit_8 D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so 2019-10-13 17:07:18.617 28995-29016/com.example.unit_8 D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so 2019-10-13 17:07:18.695 28995-28995/com.example.unit_8 W/.example.unit_: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) 2019-10-13 17:07:18.695 28995-28995/com.example.unit_8 W/.example.unit_: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) 2019-10-13 17:07:18.849 28995-29014/com.example.unit_8 D/HostConnection: HostConnection::get() New Host Connection established 0xd753b9a0, tid 29014 2019-10-13 17:07:18.855 28995-29014/com.example.unit_8 D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 2019-10-13 17:07:18.874 28995-29014/com.example.unit_8 W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 2019-10-13 17:07:18.876 28995-29014/com.example.unit_8 D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0 2019-10-13 17:07:18.876 28995-29014/com.example.unit_8 D/EGL_emulation: eglCreateContext: 0xe2c1c180: maj 2 min 0 rcv 2 2019-10-13 17:07:18.877 28995-29014/com.example.unit_8 D/EGL_emulation: eglMakeCurrent: 0xe2c1c180: ver 2 0 (tinfo 0xe2cfded0) 2019-10-13 17:07:18.942 28995-29014/com.example.unit_8 W/Gralloc3: mapper 3.x is not supported 2019-10-13 17:07:18.948 28995-29014/com.example.unit_8 D/HostConnection: createUnique: call 2019-10-13 17:07:18.950 28995-29014/com.example.unit_8 D/HostConnection: HostConnection::get() New Host Connection established 0xd753d110, tid 29014 2019-10-13 17:07:18.969 28995-29014/com.example.unit_8 D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_2 2019-10-13 17:07:18.969 28995-29014/com.example.unit_8 D/eglCodecCommon: allocate: Ask for block of size 0x1000 2019-10-13 17:07:18.969 28995-29014/com.example.unit_8 D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3ff801000 size 0x2000 2019-10-13 17:07:19.005 28995-29014/com.example.unit_8 D/EGL_emulation: eglMakeCurrent: 0xe2c1c180: ver 2 0 (tinfo 0xe2cfded0) 2019-10-13 17:07:19.012 28995-29014/com.example.unit_8 D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 1 0 2019-10-13 17:07:34.632 28995-28995/com.example.unit_8 I/msg: R.id.send_notice
VS中编程想在AutoCAD中插入一个块参照,已经导入CAD库中需要的头文件并且找到相关的函数,但是不知道里面的Password是什么?
MFC中已经导入了CAD相关的头文件,通过编程可以在CAD中画直线、写文字,现如今想再插入一个已知的放在C盘中的块参照,找到了相关的函数但是不会用, LPDISPATCH InsertBlock(VARIANT& InsertionPoint, LPCTSTR Name, double Xscale, double Yscale, double Zscale, double Rotation, VARIANT& Password) { LPDISPATCH result; static BYTE parms[] = VTS_VARIANT VTS_BSTR VTS_R8 VTS_R8 VTS_R8 VTS_R8 VTS_VARIANT ; InvokeHelper(0x62a, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms, &InsertionPoint, Name, Xscale, Yscale, Zscale, Rotation, &Password); return result; } InsertPoint是块参照的插入点,Name是块的名称,Xscale是X比例,Rotation是插入块的比例,但是这Password不知道对应的是CAD中什么操作。向大佬请教,谢谢!
excel2016 64bit的vba中使用API函数RegisterClass注册窗体类就Excel就崩溃
excel2016 64bit的vba中使用API函数RegisterClass注册窗体类就Excel就崩溃!请问是怎么回事? ``` Option Explicit Public Declare PtrSafe Function RegisterClass Lib "user32" Alias "RegisterClassA" (Class As WNDCLASS) As Long Public Declare PtrSafe Function UnregisterClass Lib "user32" Alias "UnregisterClassA" (ByVal lpClassName As String, ByVal hInstance As Long) As Long Public Declare PtrSafe Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public Declare PtrSafe Function GetMessage Lib "user32" Alias "GetMessageA" (lpMsg As Msg, ByVal hwnd As Long, ByVal wMsgFilteRmin As Long, ByVal wMsgFilterMax As Long) As Long Public Declare PtrSafe Function TranslateMessage Lib "user32" (lpMsg As Msg) As Long Public Declare PtrSafe Function DispatchMessage Lib "user32" Alias "DispatchMessageA" (lpMsg As Msg) As Long Public Declare PtrSafe Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Public Declare PtrSafe Function LoadCursor Lib "user32" Alias "LoadCursorA" (ByVal hInstance As Long, ByVal lpCursorName As Any) As Long Public Declare PtrSafe Function LoadIcon Lib "user32" Alias "LoadIconA" (ByVal hInstance As Long, ByVal lpIconName As String) As Long Public Declare PtrSafe Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long Public Declare PtrSafe Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Public Declare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongPtrA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Public Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Public Declare PtrSafe Function MessageBox Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long Public Declare PtrSafe Function PostQuitMessage Lib "user32" (ByVal nExitCode As Long) Public Declare PtrSafe Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOPENFILENAME As OPENFILENAME) As Long Public Declare PtrSafe Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOPENFILENAME As OPENFILENAME) As Long Public Declare PtrSafe Function GetLastError Lib "kernel32" () As Long Public Type OPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As String End Type Public Const OFN_OVERWRITEPROMPT = &H2 Public Const OFN_HIDEREADONLY = &H4 Public Const OFN_PATHMUSTEXIST = &H800 Public Const OFN_FILEMUSTEXIST = &H1000 Public Type WNDCLASS style As Long lpfnwndproc As LongPtr cbClsextra As Long cbWndExtra2 As Long hInstance As LongPtr hIcon As Long hCursor As Long hbrBackground As Long lpszMenuName As String lpszClassName As String End Type Public Type POINTAPI x As Long y As Long End Type Public Type Msg hwnd As Long message As Long wParam As Long lParam As Long time As Long pt As POINTAPI End Type Public Const CS_VREDRAW = &H1 Public Const CS_HREDRAW = &H2 Public Const CW_USEDEFAULT = &H80000000 Public Const ES_MULTILINE = &H4& Public Const WS_BORDER = &H800000 Public Const WS_CHILD = &H40000000 Public Const WS_OVERLAPPED = &H0& Public Const WS_CAPTION = &HC00000 ' WS_BORDER Or WS_DLGFRAME Public Const WS_SYSMENU = &H80000 Public Const WS_THICKFRAME = &H40000 Public Const WS_MINIMIZEBOX = &H20000 Public Const WS_MAXIMIZEBOX = &H10000 Public Const WS_OVERLAPPEDWINDOW = (WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_THICKFRAME Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX) Public Const WS_EX_CLIENTEDGE = &H200& Public Const COLOR_WINDOW = 5 Public Const WM_DESTROY = &H2 Public Const WM_LBUTTONDOWN = &H201 Public Const WM_LBUTTONUP = &H202 Public Const IDC_ARROW = 32512& Public Const IDI_APPLICATION = 32512& Public Const GWL_WNDPROC = (-4) Public Const SW_SHOWNORMAL = 1 Public Const MB_OK = &H0& Public Const MB_ICONEXCLAMATION = &H30& Public Const gClassName = "MyClassName" Public Const gAppName = "My Window Caption" Public gButOldProc As Long Public gHwnd As Long, gButtonHwnd As Long, gEditHwnd As Long Public Sub Main() Dim wMsg As Msg ''Call procedure to register window classname. If false, then exit. If RegisterWindowClass = False Then Exit Sub ''Create window If CreateWindows Then ''Loop will exit when WM_QUIT is sent to the window. Do While GetMessage(wMsg, 0&, 0&, 0&) ''TranslateMessage takes keyboard messages and converts ''them to WM_CHAR for easier processing. Call TranslateMessage(wMsg) ''Dispatchmessage calls the default window procedure ''to process the window message. (WndProc) Call DispatchMessage(wMsg) Loop End If Call UnregisterClass(gClassName$, Application.hInstance) End Sub Public Function RegisterWindowClass() As Boolean Dim wc As WNDCLASS Dim a As Variant wc.style = CS_HREDRAW Or CS_VREDRAW wc.lpfnwndproc = GetAddress(AddressOf WndProc) ''Address in memory of default window procedure. wc.hInstance = Application.HinstancePtr wc.hIcon = LoadIcon(0&, IDI_APPLICATION) ''Default application icon wc.hCursor = LoadCursor(0&, IDC_ARROW) ''Default arrow wc.hbrBackground = COLOR_WINDOW ''Default a color for window. wc.lpszClassName = gClassName$ RegisterWindowClass = RegisterClass(wc) a = GetLastError Debug.Print RegisterWindowClass & "ERR" Debug.Print CStr(GetLastError()) End Function Public Function CreateWindows() As Boolean ''开始创建窗体 gHwnd& = CreateWindowEx(0&, gClassName$, gAppName$, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 208, 150, 0&, 0&, App.hInstance, ByVal 0&) ''创建一个按钮 gButtonHwnd& = CreateWindowEx(0&, "Button", "Click Here", WS_CHILD, 58, 90, 85, 25, gHwnd&, 0&, App.hInstance, 0&) ''创建一个(WS_EX_CLIENTEDGE、ES_MULTILINE风格的TextBox gEditHwnd& = CreateWindowEx(WS_EX_CLIENTEDGE, "Edit", "This is the edit control." & vbCrLf & "As you can see, it's multiline.", WS_CHILD Or ES_MULTILINE, 0&, 0&, 200, 80, gHwnd&, 0&, App.hInstance, 0&) Call ShowWindow(gHwnd&, SW_SHOWNORMAL) Call ShowWindow(gButtonHwnd&, SW_SHOWNORMAL) Call ShowWindow(gEditHwnd&, SW_SHOWNORMAL) gButOldProc& = GetWindowLong(gButtonHwnd&, GWL_WNDPROC) ''Set default window procedure of button to ButtonWndProc. Different ''settings of windows is listed in the MSDN Library. We are using GWL_WNDPROC ''to set the address of the window procedure. Call SetWindowLongPtr(gButtonHwnd&, GWL_WNDPROC, GetAddress(AddressOf ButtonWndProc)) CreateWindows = (gHwnd& <> 0) End Function '窗体运行的主函数,在注册这个窗体时已经指定的 Public Function WndProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Dim strTemp As String Select Case uMsg& Case WM_DESTROY: ''Since DefWindowProc doesn't automatically call ''PostQuitMessage (WM_QUIT). We need to do it ourselves. ''You can use DestroyWindow to get rid of the window manually. Call PostQuitMessage(0&) End Select ''Let windows call the default window procedure since we're done. WndProc = DefWindowProc(hwnd&, uMsg&, wParam&, lParam&) End Function Public Function ButtonWndProc(ByVal hwnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Select Case uMsg& Case WM_LBUTTONUP: Call MessageBox(gHwnd&, "You clicked the button!", App.Title, MB_OK Or MB_ICONEXCLAMATION) End Select ButtonWndProc = CallWindowProc(gButOldProc&, hwnd&, uMsg&, wParam&, lParam&) End Function Public Function GetAddress(ByVal lngAddr As LongPtr) As LongPtr GetAddress = lngAddr End Function ```
图的一个问题,Hike on a Graph
Problem Description "Hike on a Graph" is a game that is played on a board on which an undirected graph is drawn. The graph is complete and has all loops, i.e. for any two locations there is exactly one arrow between them. The arrows are coloured. There are three players, and each of them has a piece. At the beginning of the game, the three pieces are in fixed locations on the graph. In turn, the players may do a move. A move consists of moving one's own piece along an arrow to a new location on the board. The following constraint is imposed on this: the piece may only be moved along arrows of the same colour as the arrow between the two opponents' pieces. In the sixties ("make love not war") a one-person variant of the game emerged. In this variant one person moves all the three pieces, not necessarily one after the other, but of course only one at a time. Goal of this game is to get all pieces onto the same location, using as few moves as possible. Find out the smallest number of moves that is necessary to get all three pieces onto the same location, for a given board layout and starting positions. Input The input file contains several test cases. Each test case starts with the number n. Input is terminated by n=0. Otherwise, 1<=n<=50. Then follow three integers p1, p2, p3 with 1<=pi<=n denoting the starting locations of the game pieces. The colours of the arrows are given next as a m×m matrix of whitespace-separated lower-case letters. The element mij denotes the colour of the arrow between the locations i and j. Since the graph is undirected, you can assume the matrix to be symmetrical. Output For each test case output on a single line the minimum number of moves required to get all three pieces onto the same location, or the word "impossible" if that is not possible for the given board and starting locations. Sample Input 3 1 2 3 r b r b b b r b r 2 1 2 2 y g g y 0 Sample Output 2 impossible
基于MFC做的音乐播放器,新手,不知道问什么调试了没有声音
void Load(HWND hWnd, CString strFilepath)//将文件路径传输给MCI_OPEN_PAPMS { m_hWnd = hWnd; mciSendCommand(DeviceId, MCI_CLOSE, 0, 0); //在加载文件前先清空上一次播放的设备 mciopenparms.lpstrElementName = strFilepath; //将音乐文件路径传给设备 DWORD dwReturn; if (dwReturn = mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_ELEMENT | MCI_WAIT, (DWORD)(LPVOID)&mciopenparms)) { //如果打开玩家失败,将出错信息储存在buffer,并显示出错警告 //char buffer[256]; //获取错误码对应的错误信息 //弹出错误信息提示对话框 } DeviceId = mciopenparms.wDeviceID; //打开文件成功就关联文件到设备 } void Cmfc_music_playerDlg::OnBnClickedfilechoice() { // TODO: 在此添加控件通知处理程序代码 char szFileFilter[] = "mp3文件(*.mp3)|*.mp3|" "wma文件(*.wma)|*.wma|" "wav文件(*.wav)|*.wav|" "所有文件(*.*)|*.*|";//文件类型 CFileDialog dlg(true, NULL, NULL, OFN_HIDEREADONLY, szFileFilter); if (dlg.DoModal() == IDOK) { CString strFilepath = dlg.GetPathName();//返回文件路径 CString strFilename = dlg.GetFileName();//返回文件名 SetDlgItemText(IDC_filename, strFilename); Load(this->m_hWnd, strFilepath); } GetDlgItem(IDC_play)->EnableWindow(true); //文件读取成功时所有按钮变成可选 GetDlgItem(IDC_pause)->EnableWindow(true);//控制按钮的显示 GetDlgItem(IDC_stop)->EnableWindow(true); } //播放 void play() { MCI_PLAY_PARMS mciplayparms; mciplayparms.dwCallback = (DWORD)m_hWnd; mciplayparms.dwFrom = 0; //每次播放都是从0开始播放 mciSendCommand(DeviceId, MCI_PLAY, MCI_FROM | MCI_NOTIFY, (DWORD)(LPVOID)&mciplayparms); } //暂停 void pause() { mciSendCommand(DeviceId, MCI_PAUSE, 0, 0); } //恢复 void resume() { mciSendCommand(DeviceId, MCI_RESUME, 0, 0); } //停止 void stop() { mciSendCommand(DeviceId, MCI_STOP, 0, 0);//当点击停止按钮时,将所有的信息都清除掉 mciSendCommand(DeviceId, MCI_CLOSE, 0, 0);//点关闭按钮的时候,清除设备信息,再点播放按钮,就播放不了音乐了 //当点击停止按钮时,将所有的信息都清除掉 } //设置音量 DWORD setVolume(DWORD vol) { MCI_DGV_SETAUDIO_PARMS setvolume; //设置音量的参数结构体 setvolume.dwCallback = NULL; // setvolume.dwItem = MCI_DGV_SETAUDIO_VOLUME; //动作是设置音量 setvolume.dwValue = vol; //音量值是vol mciSendCommand(DeviceId, MCI_SETAUDIO, MCI_DGV_SETAUDIO_ITEM | MCI_DGV_SETAUDIO_VALUE, (DWORD)(LPVOID)&setvolume); return 0; } class CAboutDlg : public CDialogEx { public: CAboutDlg(); // 对话框数据 enum { IDD = IDD_ABOUTBOX }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 // 实现 protected: DECLARE_MESSAGE_MAP() }; CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD) { } void CAboutDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx) END_MESSAGE_MAP() // Cmfc_music_playerDlg 对话框 Cmfc_music_playerDlg::Cmfc_music_playerDlg(CWnd* pParent /*=NULL*/) : CDialogEx(Cmfc_music_playerDlg::IDD, pParent) { m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_int = 0; } void Cmfc_music_playerDlg::DoDataExchange(CDataExchange* pDX) { CDialogEx::DoDataExchange(pDX); DDX_Control(pDX, IDC_SLIDER1, m_slider); // DDX_Slider(pDX, IDC_SLIDER1, m_int); DDX_Text(pDX, IDC_vol, m_int); } BEGIN_MESSAGE_MAP(Cmfc_music_playerDlg, CDialogEx) ON_WM_SYSCOMMAND() ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_EN_CHANGE(IDC_filename, &Cmfc_music_playerDlg::OnChangeFilename) ON_BN_CLICKED(IDC_pause, &Cmfc_music_playerDlg::OnClickedPause) ON_BN_CLICKED(IDC_play, &Cmfc_music_playerDlg::OnClickedPlay) ON_BN_CLICKED(IDC_stop, &Cmfc_music_playerDlg::OnClickedStop) ON_NOTIFY(NM_CUSTOMDRAW, IDC_SLIDER1, &Cmfc_music_playerDlg::OnCustomdrawSlider) ON_BN_CLICKED(IDC_filechoice, &Cmfc_music_playerDlg::OnBnClickedfilechoice) ON_EN_CHANGE(IDC_vol, &Cmfc_music_playerDlg::OnEnChangevol) ON_BN_CLICKED(IDC_exitbt, &Cmfc_music_playerDlg::OnBnClickedexitbt) END_MESSAGE_MAP() // Cmfc_music_playerDlg 消息处理程序 BOOL Cmfc_music_playerDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // 将“关于...”菜单项添加到系统菜单中。 // IDM_ABOUTBOX 必须在系统命令范围内。 ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { BOOL bNameValid; CString strAboutMenu; bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); ASSERT(bNameValid); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF_SEPARATOR); pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); } } // 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动 // 执行此操作 SetIcon(m_hIcon, TRUE); // 设置大图标 SetIcon(m_hIcon, FALSE); // 设置小图标 m_slider.SetRange(0, 1000); //滑动条的移动范围 0~1000 m_slider.SetPos(500); //滑动条的指针处置位置为500,代表初试音量为500 GetDlgItem(IDC_play)->EnableWindow(false); //文件没有读取时所有按钮不可选 GetDlgItem(IDC_pause)->EnableWindow(false); GetDlgItem(IDC_stop)->EnableWindow(false); // TODO: 在此添加额外的初始化代码 return TRUE; // 除非将焦点设置到控件,否则返回 TRUE } void Cmfc_music_playerDlg::OnSysCommand(UINT nID, LPARAM lParam) { if ((nID & 0xFFF0) == IDM_ABOUTBOX) { CAboutDlg dlgAbout; dlgAbout.DoModal(); } else { CDialogEx::OnSysCommand(nID, lParam); } } // 如果向对话框添加最小化按钮,则需要下面的代码 // 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序, // 这将由框架自动完成。 void Cmfc_music_playerDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // 用于绘制的设备上下文 SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0); // 使图标在工作区矩形中居中 int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // 绘制图标 dc.DrawIcon(x, y, m_hIcon); } else { CDialogEx::OnPaint(); } } //当用户拖动最小化窗口时系统调用此函数取得光标 //显示。 HCURSOR Cmfc_music_playerDlg::OnQueryDragIcon() { return static_cast<HCURSOR>(m_hIcon); } void Cmfc_music_playerDlg::OnChangeFilename() { /** TODO: 如果该控件是 RICHEDIT 控件,它将不 发送此通知,除非重写 CDialogEx::OnInitDialog() 函数并调用 CRichEditCtrl().SetEventMask(), 同时将 ENM_CHANGE 标志“或”运算到掩码中。 TODO: 在此添加控件通知处理程序代码*/ } //播放按钮 void Cmfc_music_playerDlg::OnClickedPlay() { // TODO: 在此添加控件通知处理程序代码 play(); SetDlgItemText(IDC_pause, "暂停"); } //暂停和恢复按钮 void Cmfc_music_playerDlg::OnClickedPause() { // TODO: 在此添加控件通知处理程序代码 CString strTemp; GetDlgItemText(IDC_pause, strTemp); //获取按钮的状态 if (strTemp.Compare("暂停") == 0) { pause(); SetDlgItemText(IDC_pause,"恢复"); } if (strTemp.Compare("恢复") == 0) { resume(); SetDlgItemText(IDC_pause, "暂停"); } } //停止按钮 void Cmfc_music_playerDlg::OnClickedStop() { // TODO: 在此添加控件通知处理程序代码 stop(); SetDlgItemText(IDC_pause, "暂停"); } //GetDlgItem(IDC_play)->EnableWindow(false); //当按下stop的时候,播放和暂停不可选 //GetDlgItem(IDC_pause)->EnableWindow(false); void Cmfc_music_playerDlg::OnCustomdrawSlider(NMHDR *pNMHDR, LRESULT *pResult) { UpdateData(true); m_int = m_slider.GetPos() / 10; setVolume(m_slider.GetPos()); UpdateData(false); //LPNMCUSTOMDRAW pNMCD = reinterpret_cast<LPNMCUSTOMDRAW>(pNMHDR); // TODO: 在此添加控件通知处理程序代码 *pResult = 0; } void Cmfc_music_playerDlg::OnEnChangevol() { // TODO: 如果该控件是 RICHEDIT 控件,它将不 // 发送此通知,除非重写 CDialogEx::OnInitDialog() // 函数并调用 CRichEditCtrl().SetEventMask(), // 同时将 ENM_CHANGE 标志“或”运算到掩码中。 // TODO: 在此添加控件通知处理程序代码 } void Cmfc_music_playerDlg::OnBnClickedexitbt() { // TODO: 在此添加控件通知处理程序代码 CDialog::OnCancel(); //退出 } HRESULT Cmfc_music_playerDlg::accDoDefaultAction(VARIANT varChild) { // TODO: 在此添加专用代码和/或调用基类 return CDialogEx::accDoDefaultAction(varChild); } ```
如何使用c++通过ADO调用mysql有参存储过程并获取结果集
先放代码,遇到的问题是 调用mysql**有参**存储过程时获取不到结果集 ``` #include <iostream> #include <atlstr.h> #import "MSADO15.DLL" rename_namespace("ADOCG") rename("EOF","EndOfFile") using namespace ADOCG; using namespace std; int main() { try { HRESULT hr = CoInitialize(NULL); assert(SUCCEEDED(hr));//返回值可判断初始化COM是否成功,请用SUCCEEDED来判断 _CommandPtr m_DBCommand; //命令对象 _RecordsetPtr m_DBRecordset; //记录对象 _ConnectionPtr m_DBConnection; //数据对象 //创建对象 m_DBCommand.CreateInstance(__uuidof(Command)); m_DBRecordset.CreateInstance(__uuidof(Recordset)); m_DBConnection.CreateInstance(__uuidof(Connection)); //效验数据 if (m_DBCommand == NULL) throw TEXT("创建 m_DBCommand 对象失败"); if (m_DBRecordset == NULL) throw TEXT("创建 m_DBRecordset 对象失败"); if (m_DBConnection == NULL) throw TEXT("创建 m_DBConnection 对象失败"); CString m_strConnect; //构造连接 m_strConnect.Format(TEXT("Driver={MySQL ODBC 8.0 Unicode Driver};UID=%s;PWD=%s;DataBase=%s;Persist Security Info=True;Server=%s;Port=%d;Option=3"), "hhh", "123456", "Test", "192.168.1.115", 3306); //打开连接 m_DBConnection->Open(_bstr_t(m_strConnect), L"", L"", adConnectUnspecified); m_DBConnection->CursorLocation = adUseClient; m_DBCommand->ActiveConnection = m_DBConnection; assert(SUCCEEDED(hr));//返回值可判断初始化COM是否成功,请用SUCCEEDED来判断 LONG lParameterCount = m_DBCommand->Parameters->Count; if (lParameterCount > 0L) { for (LONG i = lParameterCount; i > 0; i--) { m_DBCommand->Parameters->Delete(i - 1); } } //添加参数 _ParameterPtr Parameter; Parameter = m_DBCommand->CreateParameter("wServerID", adInteger, adParamInput, sizeof(LONG), _variant_t((LONG)0)); m_DBCommand->Parameters->Append(Parameter); Parameter = m_DBCommand->CreateParameter("wMachineID", adInteger, adParamInput, sizeof(LONG), _variant_t((LONG)0)); m_DBCommand->Parameters->Append(Parameter); m_DBCommand->CommandText = "LoadGameRoomItem2"; m_DBCommand->CommandType = adCmdText; m_DBRecordset = m_DBCommand->Execute(NULL, NULL, adCmdStoredProc); long RecordCount = m_DBRecordset->GetRecordCount(); cout << RecordCount << endl; _variant_t DBVarValue; if (m_DBRecordset->EndOfFile != VARIANT_TRUE) { FieldsPtr RecordFields = m_DBRecordset->GetFields(); DBVarValue = RecordFields->GetItem("ServerID")->GetValue(); WORD wValue = DBVarValue; } } catch (_com_error& ComError) { cout << ComError.Description() << endl; } return 0; } ``` 储存过程如下 ``` CREATE DEFINER=`root`@`%` PROCEDURE `LoadGameRoomItem2`( in wServerID INT, in wMachineID INT ) BEGIN SELECT * from gameroominfo; END ``` 目前遇到的问题就是,怎么也获取不到结果集,RecordCount始终为零(强行读取提示“BOF 或 EOF 中有一个是“真”,或者当前的记录已被删除,所需的操作要求一个当前的记录。”并不是 显示没有其实有,而是确实没有结果集),但是如果我将参数去掉 ``` //添加参数 // _ParameterPtr Parameter; // Parameter = m_DBCommand->CreateParameter("wServerID", adInteger, adParamInput, sizeof(LONG), _variant_t((LONG)0)); // m_DBCommand->Parameters->Append(Parameter); // Parameter = m_DBCommand->CreateParameter("wMachineID", adInteger, adParamInput, sizeof(LONG), _variant_t((LONG)0)); // m_DBCommand->Parameters->Append(Parameter); CREATE DEFINER=`root`@`%` PROCEDURE `LoadGameRoomItem2`( ) BEGIN SELECT * from gameroominfo; END ``` 那么则可以获得结果集(RecordCount数量为40,if (m_DBRecordset->EndOfFile != VARIANT_TRUE)判断能进去,ServerID也能读取到),我试过在存储过程前面后面分别加一个update判断过是不是存储过程没执行成功,但是不管有参无参存储过程,两个Updata都走到了,而且不管有参无参直接在数据库调用都是有结果集的 数据库日志如下 ``` 190923 15:32:38 7534 Connect hhh@DESKTOP-989OGGH on Test 7534 Query SET NAMES utf8 7534 Query SET character_set_results = NULL 7534 Query SET SQL_AUTO_IS_NULL = 0 7534 Query select database() 7534 Query select database() 7534 Query SELECT @@tx_isolation 7534 Query set @@sql_select_limit=DEFAULT 7534 Query call LoadGameRoomItem2 7534 Quit 190923 15:47:54 7621 Connect hhh@DESKTOP-989OGGH on Test 7621 Query SET NAMES utf8 7621 Query SET character_set_results = NULL 7621 Query SET SQL_AUTO_IS_NULL = 0 7621 Query select database() 7621 Query select database() 7621 Query SELECT @@tx_isolation 7621 Prepare call LoadGameRoomItem2(?, ?) 7621 Query set @@sql_select_limit=DEFAULT 7621 Execute call LoadGameRoomItem2('0', '0') 7621 Close stmt 7621 Quit ``` 困扰小弟好几天了,希望各位神仙大佬能帮帮小弟T_T ----------------------------------编辑分界线-------------------------------- ![图片说明](https://img-ask.csdn.net/upload/201909/23/1569232509_546308.png)![图片说明](https://img-ask.csdn.net/upload/201909/23/1569232516_421262.png) 如图,是要像这样处理一张表的内容的,单单用output参数是做不到的,主要问题在如果不加参数这些东西是可以读出来的,但是加了参数就获取不到结果集了。。。。
nand flash 启动坏块,有了解过的吗?
海思3531a的板子 nand flash启动。 启动日志大致如下: Check Flash Memory Controller v100 ... Found Check Nand Flash Controller v610 ... found Special NAND id table Version 1.38 Nand ID: 0x2C 0xDA 0x90 0x95 0x06 0x00 0x00 0x00 Block:128KB Page:2KB Chip:256MB*1 OOB:64B ECC:4bit/512 Nand total size: 256MB *** Warning - bad CRC or NAND, using default environment ... VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4 yaffs: dev is 32505858 name is "mtdblock2" rw yaffs: passed flags "" VFS: Mounted root (yaffs2 filesystem) on device 31:2. Freeing unused kernel memory: 172K (c05bf000 - c05ea000) Welcome to HiLinux. ... 系统启动后,输入dmesg ~ # dmesg yaffs: checking block 1692 bad yaffs: checking block 1693 bad yaffs: checking block 1694 bad ... yaffs: checking block 1998 bad yaffs: checking block 1999 bad yaffs: yaffs_read_super: is_checkpointed 0 VFS: Mounted root (yaffs2 filesystem) on device 31:2. Freeing unused kernel memory: 172K (c05bf000 - c05ea000) >udev[702]: starting version 164 Hisilicon Media Memory Zone Manager ... 有的时候启动只提示以下异常: VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4 yaffs: dev is 32505858 name is "mtdblock2" rw yaffs: passed flags "" yaffs: yaffs: Attempting MTD mount of 31.2,"mtdblock2" yaffs: checking block 0 bad yaffs: checking block 822 bad yaffs: yaffs_read_super: is_checkpointed 1 VFS: Mounted root (yaffs2 filesystem) on device 31:2. Freeing unused kernel memory: 172K (c05bf000 - c05ea000) >udev[702]: starting version 164 进入uboot,输入指令 nand bad # nand bad Device 0 bad blocks 请问这种情况的坏块,可能是那些因素导致的? 希望了解过的指导下,万分感谢!
MFC中worksheets.add 将新建sheet加在某sheet后的示例
函数声明为 LPDISPATCH Add(VARIANT& Before, VARIANT& After, VARIANT& Count, VARIANT& Type) 我能查到的使用方法为 sheets.Add( covOptional,covOptional,COleVariant((short)1),covOptional);covOptional表未定义 这样是自动将新建sheet放在最前面的,可我想把它放在最后面。有办法么?注意是MFC,不是VB。 这个“VARIANT& After”要怎么写,才能生效?是写sheet名,还是写数字?要是能写数字,那就好了。 同理,那个void Move(VARIANT& Before, VARIANT& After)里面的这个怎么表示? 我查到有说这样干的; Worksheet=ExcelSheet.get_Item(COleVariant((long)1)); ExcelSheet.Add(vtMissing, _variant_t(Worksheet),_variant_t((long)1),vtMissing); 但是我一编译,就出现 ”_variant_t“找不到标识符的错误。我用的VS08. 这个我也发了一个问答,要是可以解决,两题的分一起送上。
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私...
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
Linux(服务器编程):15---两种高效的事件处理模式(reactor模式、proactor模式)
前言 同步I/O模型通常用于实现Reactor模式 异步I/O模型则用于实现Proactor模式 最后我们会使用同步I/O方式模拟出Proactor模式 一、Reactor模式 Reactor模式特点 它要求主线程(I/O处理单元)只负责监听文件描述符上是否有事件发生,有的话就立即将时间通知工作线程(逻辑单元)。除此之外,主线程不做任何其他实质性的工作 读写数据,接受新的连接,以及处...
阿里面试官问我:如何设计秒杀系统?我的回答让他比起大拇指
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图和个人联系方式,欢迎Star和指教 前言 Redis在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在Redis的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了...
五年程序员记流水账式的自白。
不知觉已中码龄已突破五年,一路走来从起初铁憨憨到现在的十九线程序员,一路成长,虽然不能成为高工,但是也能挡下一面,从15年很火的android开始入坑,走过java、.Net、QT,目前仍处于android和.net交替开发中。 毕业到现在一共就职过两家公司,目前是第二家,公司算是半个创业公司,所以基本上都会身兼多职。比如不光要写代码,还要写软著、软著评测、线上线下客户对接需求收集...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n...
一文详尽系列之模型评估指标
点击上方“Datawhale”,选择“星标”公众号第一时间获取价值内容在机器学习领域通常会根据实际的业务场景拟定相应的不同的业务指标,针对不同机器学习问题如回归、分类、排...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外...
压测学习总结(1)——高并发性能指标:QPS、TPS、RT、吞吐量详解
一、QPS,每秒查询 QPS:Queries Per Second意思是“每秒查询率”,是一台服务器每秒能够相应的查询次数,是对一个特定的查询服务器在规定时间内所处理流量多少的衡量标准。互联网中,作为域名系统服务器的机器的性能经常用每秒查询率来衡量。 二、TPS,每秒事务 TPS:是TransactionsPerSecond的缩写,也就是事务数/秒。它是软件测试结果的测量单位。一个事务是指一...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
程序员该看的几部电影
1、骇客帝国(1999) 概念:在线/离线,递归,循环,矩阵等 剧情简介: 不久的将来,网络黑客尼奥对这个看似正常的现实世界产生了怀疑。 他结识了黑客崔妮蒂,并见到了黑客组织的首领墨菲斯。 墨菲斯告诉他,现实世界其实是由一个名叫“母体”的计算机人工智能系统控制,人们就像他们饲养的动物,没有自由和思想,而尼奥就是能够拯救人类的救世主。 可是,救赎之路从来都不会一帆风顺,到底哪里才是真实的世界?如何...
Python绘图,圣诞树,花,爱心 | Turtle篇
每周每日,分享Python实战代码,入门资料,进阶资料,基础语法,爬虫,数据分析,web网站,机器学习,深度学习等等。 公众号回复【进群】沟通交流吧,QQ扫码进群学习吧 微信群 QQ群 1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle()...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
还记得那个提速8倍的IDEA插件吗?VS Code版本也发布啦!!
去年,阿里云发布了本地 IDE 插件 Cloud Toolkit,仅 IntelliJ IDEA 一个平台,就有 15 万以上的开发者进行了下载,体验了一键部署带来的开发便利。时隔一年的今天,阿里云正式发布了 Visual Studio Code 版本,全面覆盖前端开发者,帮助前端实现一键打包部署,让开发提速 8 倍。 VSCode 版本的插件,目前能做到什么? 安装插件之后,开发者可以立即体验...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
2019年除夕夜的有感而发
天气:小雨(加小雪) 温度:3摄氏度 空气:严重污染(399) 风向:北风 风力:微风 现在是除夕夜晚上十点钟,再有两个小时就要新的一年了; 首先要说的是我没患病,至少现在是没有患病;但是心情确像患了病一样沉重; 现在这个时刻应该大部分家庭都在看春晚吧,或许一家人团团圆圆的坐在一起,或许因为某些特殊原因而不能团圆;但不管是身在何处,身处什么境地,我都想对每一个人说一句:新年快乐! 不知道csdn这...
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o...
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ...... ...
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!...
2020年的1月,我辞掉了我的第一份工作
其实,这篇文章,我应该早点写的,毕竟现在已经2月份了。不过一些其它原因,或者是我的惰性、还有一些迷茫的念头,让自己迟迟没有试着写一点东西,记录下,或者说是总结下自己前3年的工作上的经历、学习的过程。 我自己知道的,在写自己的博客方面,我的文笔很一般,非技术类的文章不想去写;另外我又是一个还比较热衷于技术的人,而平常复杂一点的东西,如果想写文章写的清楚点,是需要足够...
别低估自己的直觉,也别高估自己的智商
所有群全部吵翻天,朋友圈全部沦陷,公众号疯狂转发。这两周没怎么发原创,只发新闻,可能有人注意到了。我不是懒,是文章写了却没发,因为大家的关注力始终在这次的疫情上面,发了也没人看。当然,我...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。 再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。 下文是原回答,希望能对你能有所启发。 如果我说,这个世界上人真的分三六九等,...
节后首个工作日,企业们集体开晨会让钉钉挂了
By 超神经场景描述:昨天 2 月 3 日,是大部分城市号召远程工作的第一天,全国有接近 2 亿人在家开始远程办公,钉钉上也有超过 1000 万家企业活跃起来。关键词:十一出行 人脸...
Java基础知识点梳理
虽然已经在实际工作中经常与java打交道,但是一直没系统地对java这门语言进行梳理和总结,掌握的知识也比较零散。恰好利用这段时间重新认识下java,并对一些常见的语法和知识点做个总结与回顾,一方面为了加深印象,方便后面查阅,一方面为了掌握好Android打下基础。
2020年全新Java学习路线图,含配套视频,学完即为中级Java程序员!!
新的一年来临,突如其来的疫情打破了平静的生活! 在家的你是否很无聊,如果无聊就来学习吧! 世上只有一种投资只赚不赔,那就是学习!!! 传智播客于2020年升级了Java学习线路图,硬核升级,免费放送! 学完你就是中级程序员,能更快一步找到工作! 一、Java基础 JavaSE基础是Java中级程序员的起点,是帮助你从小白到懂得编程的必经之路。 在Java基础板块中有6个子模块的学...
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合...
相关热词 c# 为空 判断 委托 c#记事本颜色 c# 系统默认声音 js中调用c#方法参数 c#引入dll文件报错 c#根据名称实例化 c#从邮件服务器获取邮件 c# 保存文件夹 c#代码打包引用 c# 压缩效率
立即提问