T
Tony
Using vsnet2005
In the code below, I don't really need the two commented out dateTime
variables there, but my question is, if the fields in oracle is null,
why would it not just set the variable to null?
I get an exception "No data exists for the row or column."
Also, the Status field (which is defined as char in the table)
contains a space in the 1 record in the table so far, returns an
exception
"Specified method is not supported."
when reading it with the commented out reader.getchar line below
but when I use get value and convert it to char, all is well.
How os the specified method not supported?
public partial class Form1 : Form
{
Int32 iTRANS_SFTP_ID;
DateTime dtDATE_TIME_STAMP;
DateTime dtDATE_TIME_PROCESSED;
DateTime dtDATE_TIME_COMPLETED;
string strPROGRAM_NAME;
char chrSTATUS;
string strLOCAL_FILE_PATH;
string strLOCAL_FILE_NAME;
string strREMOTE_FILE_PATH;
string strREMOTE_FILE_NAME;
Int32 iREMOTE_SERVER_ID;
............
public void ReadData(string connectionString)
{
string queryString = ("SELECT TRANS_SFTP_ID,
DATE_TIME_STAMP, DATE_TIME_PROCESSED, " +
"DATE_TIME_COMPLETED,PROGRAM_NAME,STATUS, LOCAL_FILE_PATH," +
"LOCAL_FILE_NAME, REMOTE_FILE_PATH,
" +
"REMOTE_FILE_NAME,REMOTE_SERVER_ID
FROM trans_sftp");
MessageBox.Show(queryString);
using (OracleConnection connection = new
OracleConnection(connectionString))
{
OracleCommand command = new OracleCommand(queryString,
connection);
connection.Open();
OracleDataReader reader;
reader = command.ExecuteReader();
while (reader.Read())
{
iTRANS_SFTP_ID = (reader.GetInt32(0));
dtDATE_TIME_STAMP = (reader.GetDateTime(1));
//dtDATE_TIME_PROCESSED = (reader.GetDateTime(2));
//dtDATE_TIME_COMPLETED = (reader.GetDateTime(3));
strPROGRAM_NAME = (reader.GetString(4));
// chrSTATUS = (reader.GetChar(5));
chrSTATUS = (Convert.ToChar(reader.GetValue(5)));
strLOCAL_FILE_PATH = (reader.GetString(6));
strLOCAL_FILE_NAME = (reader.GetString(7));
strREMOTE_FILE_PATH = (reader.GetString(8));
strREMOTE_FILE_NAME = (reader.GetString(9));
iREMOTE_SERVER_ID = (reader.GetInt32(10));
Thanks in advance for any assistance.!!
I plan on converting each variable to an array to hold multiple
records if needed, but I'm working on the simplest form of the app to
start with,
Tony!
In the code below, I don't really need the two commented out dateTime
variables there, but my question is, if the fields in oracle is null,
why would it not just set the variable to null?
I get an exception "No data exists for the row or column."
Also, the Status field (which is defined as char in the table)
contains a space in the 1 record in the table so far, returns an
exception
"Specified method is not supported."
when reading it with the commented out reader.getchar line below
but when I use get value and convert it to char, all is well.
How os the specified method not supported?
public partial class Form1 : Form
{
Int32 iTRANS_SFTP_ID;
DateTime dtDATE_TIME_STAMP;
DateTime dtDATE_TIME_PROCESSED;
DateTime dtDATE_TIME_COMPLETED;
string strPROGRAM_NAME;
char chrSTATUS;
string strLOCAL_FILE_PATH;
string strLOCAL_FILE_NAME;
string strREMOTE_FILE_PATH;
string strREMOTE_FILE_NAME;
Int32 iREMOTE_SERVER_ID;
............
public void ReadData(string connectionString)
{
string queryString = ("SELECT TRANS_SFTP_ID,
DATE_TIME_STAMP, DATE_TIME_PROCESSED, " +
"DATE_TIME_COMPLETED,PROGRAM_NAME,STATUS, LOCAL_FILE_PATH," +
"LOCAL_FILE_NAME, REMOTE_FILE_PATH,
" +
"REMOTE_FILE_NAME,REMOTE_SERVER_ID
FROM trans_sftp");
MessageBox.Show(queryString);
using (OracleConnection connection = new
OracleConnection(connectionString))
{
OracleCommand command = new OracleCommand(queryString,
connection);
connection.Open();
OracleDataReader reader;
reader = command.ExecuteReader();
while (reader.Read())
{
iTRANS_SFTP_ID = (reader.GetInt32(0));
dtDATE_TIME_STAMP = (reader.GetDateTime(1));
//dtDATE_TIME_PROCESSED = (reader.GetDateTime(2));
//dtDATE_TIME_COMPLETED = (reader.GetDateTime(3));
strPROGRAM_NAME = (reader.GetString(4));
// chrSTATUS = (reader.GetChar(5));
chrSTATUS = (Convert.ToChar(reader.GetValue(5)));
strLOCAL_FILE_PATH = (reader.GetString(6));
strLOCAL_FILE_NAME = (reader.GetString(7));
strREMOTE_FILE_PATH = (reader.GetString(8));
strREMOTE_FILE_NAME = (reader.GetString(9));
iREMOTE_SERVER_ID = (reader.GetInt32(10));
Thanks in advance for any assistance.!!
I plan on converting each variable to an array to hold multiple
records if needed, but I'm working on the simplest form of the app to
start with,
Tony!