Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8961431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:53:28+00:00 2026-06-15T15:53:28+00:00

CString m_strRemorcaNmb; // value for this string is set before CString path = DB\\dataBase;

  • 0
CString m_strRemorcaNmb; // value for this string is set before 
CString path = "DB\\dataBase";
CDaoDatabase db;
try
{
    db.Open(path, 0, 0, "");
    CDaoRecordset rs(&db);
    rs.Open(AFX_DAO_USE_DEFAULT_TYPE, _T("SELECT Numar_inmatriculare FROM Masini;"), 0);

    COleVariant searched(m_strRemorcaNmb); 
    BOOL bFound = rs.Seek("=",&searched);
}

Here i try to verify if a CString value is contained in my data base (.mdb). When it reaches BOOL bFound = rs.Seek("=",&searched); a debug assertion failed error is thrown. Hitting retry on the dialog box the application triggers a breakpoint in daocore.cpp at this line ASSERT(m_nOpenType == dbOpenTable);.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:53:29+00:00Added an answer on June 15, 2026 at 3:53 pm

    To use Seek you have to have a table-type recordset. (See MSDN: http://msdn.microsoft.com/en-US/library/k3tkt1zd%28v=vs.80%29.aspx) To get this, you have to specify the type when you open the recordset.

    Example:

    rs.Open(CDaoRecordSet::dbOpenTable,"table1");
    

    This way of checking, if a specific record exists, is very slow. You suck all the records over the network and then check them. It is way better to modify the filter of the recordset before opening, and then check if any records have been returned.

    Method A:

    sql = "SELECT count(*) AS xyz FROM table WHERE Field='value'";
    rs.Open(CDaoRecordset::dbOpenSnapshot,sql);
    COleVariant count = rs.GetFieldValue(0);
    

    Method B for generated recordsets:

    rs.m_strFilter.Format("Field = '%s'", value);
    rs.Open(CDaoRecordset::dbOpenSnapshot,"table");
    
    if(rs.IsEOF()) // no records returned
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a CString which contains a number value e.g. 45.05 and I
I am new to Cstring, sorry for asking dumb question, please help. char string[10];
I'm making my own string class and I'd like to ensure that CString a
I'm sure that many of you are familiar with this set of warnings. These
I'm using CString::Tokenize method in order to tokenize a string using a delimiter, but
MFC File: winctrl4.cpp (C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\src\mfc) CString CRichEditCtrl::GetSelText() const { ASSERT(::IsWindow(m_hWnd)); CHARRANGE
I am using the following code: CAtlNavigateData navData; CStringA m_strForm = name=+++&priv=1&password=; navData.SetPostData((BYTE*)(LPSTR)(LPCSTR)m_strForm, m_strForm.GetLength(),
I need to convert CString to BYTE array. I don't know why, but everything
I have a code in which Cstring and wchar_t both are used. I think
If I have code such as class CString { int GetLength(); }; bool smaller(CString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.