Hi - retired developer looking for some specific details on embedded sql (1 Viewer)

bluesboy145

New member
Local time
Today, 14:04
Joined
May 21, 2012
Messages
4
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, 21:04
Joined
Apr 25, 2012
Messages
1,302
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
 

bluesboy145

New member
Local time
Today, 14:04
Joined
May 21, 2012
Messages
4
I appreciate the quick reply. Now I need to see what that means to me in C++/CLI.
Thank you.
 

bluesboy145

New member
Local time
Today, 14:04
Joined
May 21, 2012
Messages
4
It took me a whole a day of searching but I finally found the key:

System::Data::DataSet^ ds = gcnew System::Data::DataSet();

I can make it from here.
Thanks again.
 

bluesboy145

New member
Local time
Today, 14:04
Joined
May 21, 2012
Messages
4
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;
}
 

Users who are viewing this thread

Top Bottom