T
tawright915
I need to return a struct from another class. I set it up like this:
public struct myData
{
public int mPKey;
public String mOrgDate;
public String mDataText;
public myData(int mPKey, String mOrgDate, String mDataText)
{
this.mPKey = mPKey;
this.mOrgDate = mOrgDate;
this.mDataText = mDataText;
}
}
public myData GetNextRecord()
{
SqlConnection myConnection = new SqlConnection(strConnect);
SqlDataReader myReader = null;
ETC..........
myData mydata;
mydata.mPKey = myReader.GetInt32(myReader.GetOrdinal("DMV1_P_KEY"));
mydata.mOrgDate =
myReader.GetString(myReader.GetOrdinal("DMV1_ORG_DTTM"));
mydata.mDataText =
myReader.GetString(myReader.GetOrdinal("DMV1_DATA_TEXT"));
myConnection.Close();
return mydata;
}
However I do not seem to under stand how to reference this on the
calling method side. Thanks.
public struct myData
{
public int mPKey;
public String mOrgDate;
public String mDataText;
public myData(int mPKey, String mOrgDate, String mDataText)
{
this.mPKey = mPKey;
this.mOrgDate = mOrgDate;
this.mDataText = mDataText;
}
}
public myData GetNextRecord()
{
SqlConnection myConnection = new SqlConnection(strConnect);
SqlDataReader myReader = null;
ETC..........
myData mydata;
mydata.mPKey = myReader.GetInt32(myReader.GetOrdinal("DMV1_P_KEY"));
mydata.mOrgDate =
myReader.GetString(myReader.GetOrdinal("DMV1_ORG_DTTM"));
mydata.mDataText =
myReader.GetString(myReader.GetOrdinal("DMV1_DATA_TEXT"));
myConnection.Close();
return mydata;
}
However I do not seem to under stand how to reference this on the
calling method side. Thanks.