DateTime <-> DbTimeStamp

V

VM

Hi EveryBody,

I'm diggin' a lot into it and cannot find a way out... (yes, maybe it's
backwards :)

OleDbConnection handshaking a Sybase database...

Stored procedure A gets two parameters: datetime refDate (Input) and
datetime foundDate (Output)
foundDate should be a working date, it calls stored procedure B which in
turns queries a table for holidays...
those sp actually works because those strange powerbuilder programmers use
them widely.
I've checked the permissions for the user I'm using to connect to the
database, and everything is ok.

I'm developing a website with data access thru webservices and data access
classes.
The web queries the web service, the webservice instantiates the data access
class using an OleDbConnection wired with an OleDbCommand.

Here's the data access class code:

public DateTime GetLastWorkingDate(DateTime refDate)
{
DateTime dtDate;
oleDbConnection1.Open();
oleDbCommand1.Parameters[1].Value=refDate;
oleDbCommand1.ExecuteNonQuery();
oleDbConnection1.Close();
dtDate = Convert.ToDateTime(oleDbCommand1.Parameters[2].Value); // I'm
getting a DBNull here
return dtDate;
}

Here's the component's designer code for oleDbCommand1:

this.oleDbCommand1.CommandText = "sp_former_working_date";
this.oleDbCommand1.CommandType = System.Data.CommandType.StoredProcedure;
this.oleDbCommand1.Connection = this.oleDbConnection1;
this.oleDbCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("RETURN_VALUE",
System.Data.OleDb.OleDbType.Integer, 4,
System.Data.ParameterDirection.ReturnValue, false, ((System.Byte)(10)),
((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));
this.oleDbCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("ref_date",
System.Data.OleDb.OleDbType.DBTimeStamp, 16));
this.oleDbCommand1.Parameters.Add(new
System.Data.OleDb.OleDbParameter("calc_date",
System.Data.OleDb.OleDbType.DBTimeStamp, 16,
System.Data.ParameterDirection.Output, false, ((System.Byte)(0)),
((System.Byte)(0)), "", System.Data.DataRowVersion.Current, null));

I suspect there's a casting problem, unless there's no compiler nor runtime
error message for that...

Any help?
TIA,
VM
 

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