Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » fetch not reading into struct
fetch not reading into struct [message #32661] Wed, 01 June 2011 02:11 Go to previous message
jjacksonRIAB is currently offline  jjacksonRIAB
Messages: 221
Registered: June 2011
Experienced Member
I have a session created with MSSQL and am reading from a view in SQL server. My .sch file looks like this:

TABLE_ (PUNCH_VIEW)
	STRING_ (EMPLOYEE_ID, 6)
	STRING_ (FIRST_NAME, 15)
	STRING_ (LAST_NAME, 16)
END_TABLE


Now, when I create a session, I'm running over VPN so I have to impersonate first, then I create my connection and try to run a select:
S_PUNCH_VIEW view;

Sql sql(dbSession);
sql * Select(view).From(PUNCH_VIEW);

while(sql.Fetch(view))
{
    if(view.FIRST_NAME == "John")
    {
        // add this text to a GridCtrl
    }

    // Add data to GridCtrl
    grid.Add(sql);
}


For some reason the fetch is not filling S_PUNCH_VIEW "view" with any data. It's just empty through each cycle in the loop, but grid.Add(sql) actually works and displays the data.

Additionally if I try sql[FIRST_NAME] instead, I get an exception: "Assertion failed in Sql.cpp line 287 0". Any hints as to what I'm doing wrong?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Creating a TIMESTAMP column in MySQL
Next Topic: Sqlite with U++
Goto Forum:
  


Current Time: Mon May 13 04:43:34 CEST 2024

Total time taken to generate the page: 0.02299 seconds