I want to get a record from MyTable which GroupID=3 AND account='abc' AND usename='tom'" but it alway ERROR "Too few parameters" CMyRecordSet is; str.Format("GroupID=%d AND account=\'%s\' AND usename=\'%s\'" ,iGroupID ,theApp.m_strAccount ,theApp.m_strUsername); is.m_strFilter=str; is.Open();
:mad::mad::mad::mad: Too few parameters. Expected 1. <= ERROR :eek: help me :doh: I think I do not do anything wrong in this SQL it similars with is.Open(AFX_DB_USE_DEFAULT_TYPE,"SELECT * FROM MyTable WHERE GroupID=3 AND account='abc' AND usename='tom'");
both ERROR :((:((:((
_skidrow_vn_
Posts
-
I cannot SELECT RECORD by CRecordset ? -
Can I get the value of newid() function of SQLserver2k from ASPASP & SQLserver2k & Windows2003 I use ASP to add data to 2 tables I have 2 tables: Invoice and InvoiceDetail Invoice contains: InvoiceID, ClientName, InvoiceDate........ InvoiveDetail contains: InvoiceID, Name,Price,Quantity.... I set default of InvoiceID(Invoice table)=newid() so I dont need to insert a new value when I add a new record but I can not get value of newid() Example: Invoice for Client "Tom" I use "INSERT Invoice (ClientName, InvoiceDate) VALUES ('Tom','30/1/2004')" and SQLserver2k auto create a value for InvoiceID such as {BB10687B-87F7-44E4-9397-8D510BBDFA9C} and then ..... I WANT TO GET {BB10687B-87F7-44E4-9397-8D510BBDFA9C} I NEED IT to add detail of this invoice for InvoiceDetail table like: InvoiceID - Name - Price - Quantity {BB10687B-87F7-44E4-9397-8D510BBDFA9C} - book - 26.5$ - 5 {BB10687B-87F7-44E4-9397-8D510BBDFA9C} - CD - 700.95$ - 1 I think 1) SELECT InvoiceID FROM Invoice WHERE ClientName='Tom' AND InvoiceDate='30/1/2004'" but this is not good, may be duplicate all value in all column 2) May I have to add a new column in table 3) I have to calculate my InvoiceID and not use newid() function of SQLsrv2k :(( Please help me to get value of newid() function in SQLserver2k thanks alot
-
Get value of newid() function of SQLsrv2k from ASPASP & SQLserver2k & Windows2003 I use ASP to add data to 2 tables I have 2 tables: Invoice and InvoiceDetail Invoice contains: InvoiceID, ClientName, InvoiceDate........ InvoiveDetail contains: InvoiceID, Name,Price,Quantity.... I set default of InvoiceID(Invoice table)=newid() so I dont need to insert a new value when I add a new record but I can not get value of newid() Example: Invoice for Client "Tom" I use "INSERT Invoice (ClientName, InvoiceDate) VALUES ('Tom','30/1/2004')" and SQLserver2k auto create a value for InvoiceID such as {BB10687B-87F7-44E4-9397-8D510BBDFA9C} and then ..... I WANT TO GET {BB10687B-87F7-44E4-9397-8D510BBDFA9C} I NEED IT to add detail of this invoice for InvoiceDetail table like: InvoiceID - Name - Price - Quantity {BB10687B-87F7-44E4-9397-8D510BBDFA9C} - book - 26.5$ - 5 {BB10687B-87F7-44E4-9397-8D510BBDFA9C} - CD - 700.95$ - 1 I think 1) SELECT InvoiceID FROM Invoice WHERE ClientName='Tom' AND InvoiceDate='30/1/2004'" but this is not good, may be duplicate all value in all column 2) May I have to add a new column in table 3) I have to calculate my InvoiceID and not use newid() function of SQLsrv2k:doh::sigh: Please help me to get value of newid() function in SQLserver2k thanks alot
-
Reduce flicker in ListView ?I have 20 items in my List View and I update them rapidly (change text of subitem) interval = 100millisecond (report type only) They are very flicker Is there a way to fix it ? VC6,XP thank a lot ~!
-
How to get count of bytes SENT and RECEIVED ?I dont know how get how many bytes which Sent and Received through by internet connection ? help me !
-
Create shortcut key ??My App is running and I am typing words in NotePad.exe I want my App show a messagebox (such as "hello") (when I press Ctrl+Shift+H) when I using any program in Windows? which function to do this? thank you! :rose:
-
capture screen with cursorWhen I capture screen with PrintScreen then paste it in Paint.exe.........the cursor always disappear...... How can I capture include Cursor? Is there a code to do this ? thank
-
read/write BMP,JPG,GIF file ?Can you help me or show me where have source code to do this I want read/write BMP,JPG,GIF file more detail: I will capture all screen .....after then save it in BMP,JPG,GIF format thank you very much :):rose:
-
set align for header controlI want to set align for each column in my listview so I get handle of header control of listview then use SetItem member function of CHeaderCtrl to do this. About Align => ok, I got it but I lost all caption (text) in each column header (no text in headers) if I use only hdi.mask = HDI_TEXT; >> my texts will not disappear What I need to do to set align for each column and all text is still appear ///////////////////////////////////////////////// #define LEFT 1 #define CENTER 2 #define RIGHT 3 MyListViewCtrl m_ListCtrl; m_ListCtrl.cColumnMax = 4; m_ListCtrl.InsertColumn (0, "#");//left-default m_ListCtrl.InsertColumn (1, "ID");//left m_ListCtrl.rgcAlign[1]=1; m_ListCtrl.InsertColumn (2, "Name");//center m_ListCtrl.rgcAlign[2]=2; m_ListCtrl.InsertColumn (3, "Cost");//right m_ListCtrl.rgcAlign[3]=3; m_ListCtrl.SetAlign();//set align for all column //////////////////////////////////////////// void MyListViewCtrl::SetAlign() { CHeaderCtrl* pHeader = GetHeaderCtrl( ); HDITEM hdi; for (int i=0; iGetItem(i, &hdi)); hdi.fmt = (rgcAlign[i]==LEFT?HDF_LEFT:(rgcAlign[i]==CENTER?HDF_CENTER:HDF_RIGHT)); hdi.pszText = buffer; hdi.cchTextMax = 256; VERIFY(pHeader->SetItem(i, &hdi)); } }
-
MDIChildWnd flicker !!!Could you show me more detail about this ? You mean: I do paint in CMDIChildWnd based class or CFormView based class of MDIChildWnd ?? in class which derive from CFormView have no WM_ERASEBKGND message ?! I also do paint in both but not result, when resize it still flicker. help me.......thanks:rose:
-
MDIChildWnd flicker !!!I set background bitmap for my MDIChildWnd >>> okay
void CTest2View::OnPaint() // MDIChildWnd { CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here // My code to paint background.....draw to dc }
but When I resize MDIChildWnd, it 's flicker I can not fix it help me -
scroll in listview ???scroll in listview ??? my listview has 16 columns and it dont show all of data in it. Is there a way to scroll to right (such as to display last column) without use HScroll thanks
-
SendMessage???void CMyDlg::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) { LV_DISPINFO *plvDispInfo = (LV_DISPINFO *)pNMHDR; LV_ITEM *plvItem = &plvDispInfo->item; **AfxMessageBox("Hello");** *pResult = FALSE; } void CMyDlg::OnButton1() { //??????? //SendMessage() //SendDlgItemMessage() //Send ????????? }
I want to run all code lines in CMyDlg::OnEndlabeleditList() when I click to Button1 such as to display a messagebox "Hello" I dont know how to do it help me thanks:rose::rose: -
Error "Recordset is read-only" ???I have 2 tables in mydatabase "Account" and "Employee" I want to edit my record but there is a Error messagebox always show ----------------------------- "Recordset is read-only" ----------------------------- How can I fix it? thanks
// I want to Edit password,permission of employee // who have ID="John" >>>>>> Account.ID="John" then..... // Account.Pass="John1" => edit to new password => Account.Pass="John2" // Employee.Permission=2 => edit to new permission => Employee.Permission=3 // QLBH2Set.cpp : implementation of the CAccountSet class // IMPLEMENT_DYNAMIC(CAccountSet, CRecordset) CAccountSet::CAccountSet(CDatabase* pdb) : CRecordset(pdb) { m_ID = _T(""); m_Pass = _T(""); m_Employee_ID = _T(""); m_Permission = 0; m_nFields = 4; m_nDefaultType = dynaset;//snapshot; } CString CAccountSet::GetDefaultConnect() { return _T("ODBC;DRIVER=Microsoft Access Driver (*.mdb);DBQ=C:\\MyDB.mdb"); } CString CAccountSet::GetDefaultSQL() { return _T([Account],[Employee]); } void CAccountSet::DoFieldExchange(CFieldExchange* pFX) { pFX->SetFieldType(CFieldExchange::outputColumn); RFX_Text(pFX, _T("[ID]"), m_ID); RFX_Text(pFX, _T("[Pass]"), m_Pass); RFX_Long(pFX, _T("[Permission]"), m_Permission); RFX_Text(pFX, _T("[Employee_ID]"), m_Employee_ID); } ///////////////////////////////////////////////////////////////////////////// // CChangePassword dialog class CChangePassword : public CDialog { // Construction public: CChangePassword(CWnd* pParent = NULL); // standard constructor CAccountSet m_Set; ..... } ///////////////////////////////////////////////////////////////////////////// // CChangePassword message handlers void CChangePassword::OnOK() { ....... m_Set.m_strFilter = "Account.ID = Employee.Employee_ID"; m_Set.Open(CRecordset::dynaset, _T( "SELECT ALL Account.ID,Account.Pass,Employee.Permission FROM Account INNER JOIN Employee ON Account.ID=Employee.Empoyee_ID" ), CRecordset::executeDirect); // I want to Edit password,permission of employee // who have ID="John" >>>>>> Account.ID="John" // Account.Pass="John1" => edit to new password => Account.Pass="John2" // Employee.Permission=2 => edit to new permission => Employee.Permission=3 m_Set.Edit(); m_Set.m_Pass = strNewPass; m_Set.Update( ); m_Set.Requery (); m_Set.Close(); ..... }
-
malloc ?strcpy(p+150-1,"\0"); _strset(p,'A'); >> when I debug: _msize(p)=150 strlen(p)=149 and Error MsgBox isn't shown thank youuuu:rose:
-
malloc ?malloc ? I want to allocate a memory block (such as 150 bytes) with all chars are initialize with "A" this is my way: char* p; p=(char*)malloc(150) //if( p == NULL ) // errhanlder("Insufficient memory available"); free(p); // All okay but all chars are disorder, not "A" but when I reset all chars in my string to "A" ..... ErrMessageBox is shown char* p; p=(char*)malloc(150) //if( p == NULL ) // errhanlder("Insufficient memory available"); _strset('A'); // set all char to "A" free(p); // Error in this line, if delete this line, it runs okay Why when I try to free memory block, Error MessageBox show ? >> when I debug , I get info: // _msize(p) => return 150 but // strlen(p) => return 154 ??????? // I try to set p+150 = 0x0(nullchar) but Error still show // strcpy(p+150,0x0) help me~ and is there a way to create StrArray[a][b] with a, b are variable example : StrArray[1][1] point to a string "hello" StrArray[1][2] point to a string "bye" StrArray[2][1] point to a string "good" StrArray[2][2] point to a string "very long string ...." ........ thanks
-
print preview ???I want to call print preview window of IE to preview "myfile.htm" which similar with File/Print Preview... in IE command Is it possible?
-
Create a report in VC6?Is there a tool to create a report in VC6? I want to print a table in my database help me thanks:rose:
-
Print in VC6 ?Print in VC6 ? I used ODBC (CDatabase,CRecordset) to open "Product" table in my database file >> and I want to print this table >> Is there a way to print easily ? and a question these declarations are different ? 1) CMyClass o1,o2,o3; 2) CMyClass *p1,*p2,*p3; which decleration is flexibler (fast run and use less memory) when I should use a object like *p1 or o1 thank you very much:rose:
-
Change font of MessageBox ?and how to change font of and Titlebar of MDIChild is there a another way than use SystemParamenterInfo() help me .......thanks