D
Dion Heskett
I wish to supply the formating as a parameter, I have tried OleDbDataReader
but get a null ref.
just can't seem to get this to work. I think this has something to do with
ExecuteReader.
also can't seem to use this as the first pram
OleDbDataReader reader = new OleDbDataReader()
i.e
public static string Read(OleDbDataReader reader, string query, string
format )
this is what I would like as a parameter if possible. "<p> +
reader["Text"].ToString() + "</p>" + "\n"
//returndata += ("<p> + reader["Text"].ToString() + "</p>" + "\n" );
public static string Read(OleDbDataReader reader, string query, string
pram3 )
{
OleDbConnection conn = null;
//OleDbDataReader reader = null;
string returndata = null;
try
{
conn = new OleDbConnection(MySite.GlobalSettings.ConnectionString);
conn.Open();
OleDbCommand cmd = new OleDbCommand(query, conn);
cmd.CommandType = CommandType.StoredProcedure;
reader = cmd.ExecuteReader();
while( reader.Read() )
{
//returndata += ("<p> + reader["Text"].ToString() + "</p>" + "\n" );
}
}
// catch (Exception e)
// {
// Response.Write(e.Message);
// Response.End();
// }
finally
{
if (reader != null) reader.Close();
if (conn != null) conn.Close();
}
return returndata;
}
Thanks
Dion
but get a null ref.
just can't seem to get this to work. I think this has something to do with
ExecuteReader.
also can't seem to use this as the first pram
OleDbDataReader reader = new OleDbDataReader()
i.e
public static string Read(OleDbDataReader reader, string query, string
format )
this is what I would like as a parameter if possible. "<p> +
reader["Text"].ToString() + "</p>" + "\n"
//returndata += ("<p> + reader["Text"].ToString() + "</p>" + "\n" );
public static string Read(OleDbDataReader reader, string query, string
pram3 )
{
OleDbConnection conn = null;
//OleDbDataReader reader = null;
string returndata = null;
try
{
conn = new OleDbConnection(MySite.GlobalSettings.ConnectionString);
conn.Open();
OleDbCommand cmd = new OleDbCommand(query, conn);
cmd.CommandType = CommandType.StoredProcedure;
reader = cmd.ExecuteReader();
while( reader.Read() )
{
//returndata += ("<p> + reader["Text"].ToString() + "</p>" + "\n" );
}
}
// catch (Exception e)
// {
// Response.Write(e.Message);
// Response.End();
// }
finally
{
if (reader != null) reader.Close();
if (conn != null) conn.Close();
}
return returndata;
}
Thanks
Dion