B bluesboy145 New member Local time Today, 11:23 Joined May 21, 2012 Messages 4 May 22, 2012 #1 All i want to do (right now) is to find the 1st record in a table, grab some data, then go to the next & do the same - for all records.
All i want to do (right now) is to find the 1st record in a table, grab some data, then go to the next & do the same - for all records.
Isskint Slowly Developing Local time Today, 18:23 Joined Apr 25, 2012 Messages 1,302 May 22, 2012 #2 create a temporary recordset and use the next method to step through each record, pulling the relevant data you need. Something like... Dim con as Object Dim vrbl as String set con = Application.CurrentProject.Connection stsql = "SELECT * FROM [YourTableName]" rs.Open stsql, con, 1 If (rs.EOF) Then 'no data in table Else While (Not (rs.EOF)) vrbl = rs![FieldName] 'do what you want with vrbl rs.MoveNext Wend End If
create a temporary recordset and use the next method to step through each record, pulling the relevant data you need. Something like... Dim con as Object Dim vrbl as String set con = Application.CurrentProject.Connection stsql = "SELECT * FROM [YourTableName]" rs.Open stsql, con, 1 If (rs.EOF) Then 'no data in table Else While (Not (rs.EOF)) vrbl = rs![FieldName] 'do what you want with vrbl rs.MoveNext Wend End If
B bluesboy145 New member Local time Today, 11:23 Joined May 21, 2012 Messages 4 May 22, 2012 #3 I appreciate the quick reply. Now I need to see what that means to me in C++/CLI. Thank you.
B bluesboy145 New member Local time Today, 11:23 Joined May 21, 2012 Messages 4 May 22, 2012 #4 It took me a whole a day of searching but I finally found the key: System:ata:ataSet^ ds = gcnew System:ata:ataSet(); I can make it from here. Thanks again.
It took me a whole a day of searching but I finally found the key: System:ata:ataSet^ ds = gcnew System:ata:ataSet(); I can make it from here. Thanks again.
B bluesboy145 New member Local time Today, 11:23 Joined May 21, 2012 Messages 4 May 22, 2012 #5 My last message was erroneous. Here's my solution: public: List<String^>^ GetCustomers() { List<String^>^ customerList = gcnew List<String^>(); try { String^ sql = L"SELECT CustomerName FROM Customer"; String^ customer; OdbcCommand^ cmd = gcnew OdbcCommand(); cmd->CommandText = sql; cmd->CommandType = CommandType::Text; cmd->Connection = conn; OdbcDataReader^ connReader = cmd->ExecuteReader(CommandBehavior::CloseConnection); while(connReader->Read()) { customer = connReader->GetString(0); customerList->Add(customer); } connReader->Close(); } catch(Exception^ /*ex*/) { } return customerList; }
My last message was erroneous. Here's my solution: public: List<String^>^ GetCustomers() { List<String^>^ customerList = gcnew List<String^>(); try { String^ sql = L"SELECT CustomerName FROM Customer"; String^ customer; OdbcCommand^ cmd = gcnew OdbcCommand(); cmd->CommandText = sql; cmd->CommandType = CommandType::Text; cmd->Connection = conn; OdbcDataReader^ connReader = cmd->ExecuteReader(CommandBehavior::CloseConnection); while(connReader->Read()) { customer = connReader->GetString(0); customerList->Add(customer); } connReader->Close(); } catch(Exception^ /*ex*/) { } return customerList; }