Hi people,
I need to change return type of a function. So function should return array values.In here, data type of the array values are not int,char or double. The data type of the array values are a kind of custom type.
So confused. Please help:scared::idea::(
void DataType_Class::insert_rowData_into_array()
{
array<Custom_DataType^> ^Person = gcnew array<Custom_DataType^>(6);
Person [1] = gcnew Custom_DataType;
Person [2] = gcnew Custom_DataType;
Person [3] = gcnew Custom_DataType;
SqlConnection ^sqlConn = gcnew SqlConnection( "DataSource");
sqlConn->Open();
SqlComm ^comSelect ;
comSelect = gcnew SqlComm ("SELECT * FROM PeopleInfo ", sqlConn);
SqlDataReader ^reader ;
reader = comSelect->ExecuteReader();
int i = 1;
while (reader->Read())
{
Person [i]->id = Convert::ToInt32( reader["y_id"] );
Person [i]->name = Convert::ToString( reader["y_name"] );
Person [i]->weight = Convert::ToInt32( reader["y_weight"] );
i++;
}
sqlConn->Close();
}
Referred class :
*******************
* MyDataType.h *
*******************
using namespace System;
public ref class Custom_DataType
{
public:
int id,weight,age;
String ^name;
};