Reading MS Access Memo Field

M

M. Noroozi Eghbali

Hi All,

I used the below code to get the information from a MS Access database file:
----------------------------------------------------
bdpConnection1.Open();
bdpDataAdapter1.SelectCommand.CommandText = "SELECT * FROM Info WHERE
Email = '" +
email.Text + "'";

bdpDataAdapter1.FillSchema(dataSet1, SchemaType.Source, "Info");
RowNum = bdpDataAdapter1.Fill(dataSet1);
if(RowNum != 0)
{
UserInf.DownloadedFile =
dataSet1.Tables["Info"].Rows[0]["DownloadedFile"].ToString();//***
}
bdpConnection1.Close();
------------------------------------------------------

The "DownloadedFile" field of the database is of type Memo. After running
the code, the value of the UserInf.DownloadedFile is "system.char[]" instead
of the correct value of that. Any help?

Thank you,
Mehrdad
 
K

Kevin Spencer

What do you expect the data type to be? You can create a string from it by
using the System.String constructor overload:

new string(char[])

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 
M

M. Noroozi Eghbali

it is a struct:

struct stUserInformation
{
public String DownloadedFile;
};

Thanks,
Mehrdad


Kevin Spencer said:
What do you expect the data type to be? You can create a string from it by
using the System.String constructor overload:

new string(char[])

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

M. Noroozi Eghbali said:
Hi All,

I used the below code to get the information from a MS Access database
file:
----------------------------------------------------
bdpConnection1.Open();
bdpDataAdapter1.SelectCommand.CommandText = "SELECT * FROM Info WHERE
Email = '" +
email.Text + "'";

bdpDataAdapter1.FillSchema(dataSet1, SchemaType.Source, "Info");
RowNum = bdpDataAdapter1.Fill(dataSet1);
if(RowNum != 0)
{
UserInf.DownloadedFile =
dataSet1.Tables["Info"].Rows[0]["DownloadedFile"].ToString();//***
}
bdpConnection1.Close();
------------------------------------------------------

The "DownloadedFile" field of the database is of type Memo. After running
the code, the value of the UserInf.DownloadedFile is "system.char[]"
instead of the correct value of that. Any help?

Thank you,
Mehrdad
 
K

Kevin Spencer

An Access Memo Field is a text field. It can contain only text. It cannot
contain a struct.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

M. Noroozi Eghbali said:
it is a struct:

struct stUserInformation
{
public String DownloadedFile;
};

Thanks,
Mehrdad


Kevin Spencer said:
What do you expect the data type to be? You can create a string from it
by using the System.String constructor overload:

new string(char[])

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

M. Noroozi Eghbali said:
Hi All,

I used the below code to get the information from a MS Access database
file:
----------------------------------------------------
bdpConnection1.Open();
bdpDataAdapter1.SelectCommand.CommandText = "SELECT * FROM Info WHERE
Email = '" +
email.Text + "'";

bdpDataAdapter1.FillSchema(dataSet1, SchemaType.Source, "Info");
RowNum = bdpDataAdapter1.Fill(dataSet1);
if(RowNum != 0)
{
UserInf.DownloadedFile =
dataSet1.Tables["Info"].Rows[0]["DownloadedFile"].ToString();//***
}
bdpConnection1.Close();
------------------------------------------------------

The "DownloadedFile" field of the database is of type Memo. After
running the code, the value of the UserInf.DownloadedFile is
"system.char[]" instead of the correct value of that. Any help?

Thank you,
Mehrdad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top