FindOrCreateInventDim
12/4/2005 5:27:00 PM
Hi Daniel, thanks for your quick reply, I have tried that date format too,
but it doesnt work.
I have written a small testprogram to test the statement and it dosn't work,
i am using c# and the com connector, my code is as follows
private void DateCheck()
{
IAxaptaRecord rec = m_axapta.CreateRecord(tabell.Text);
string statement = string.Empty;
statement = sql.Text;
//This will not find anything
/*SELECT * from %1
where %1.ACCOUNTCODE == 1
&& %1.ACCOUNTRELATION == '01'
&& %1.ITEMCODE == 0
&& %1.FROMDATE == '21/02/2001'
&& %1.RELATION == 4
&& %1.MODULE == 1
&& %1.ITEMRELATION == '10132428'*/
//This will find records
/*SELECT * from %1
where %1.ACCOUNTCODE == 1
&& %1.ACCOUNTRELATION == '01'
&& %1.ITEMCODE == 0
&& %1.RELATION == 4
&& %1.MODULE == 1
&& %1.ITEMRELATION == '10132428'*/
rec.ExecuteStmt(statement);
if(rec.Found == false)
{
MessageBox.Show("Nothing was found");
return;
}
while(rec.Found == true)
{
object dateStr = rec.get_field(kolumn.Text);
if (MessageBox.Show(this,dateStr.ToString(),"Found it,
continue",MessageBoxButtons.YesNo) == DialogResult.No)
{
return;
}
rec.Next();
}
}
--
"Daniel Grau" wrote:
> you should use dd\mm\yyyy
>
> regards
> daniel
>
> "FindOrCreateInventDim" wrote:
>
> > Hi
> >
> > I am a new to x++ programming, I have written a program in c# that generates
> > some x++ sql, now I wonder how a date should be formatted in x++ to work, the
> > two following statements give different results, the x++ statemen will not
> > find anything, the sql statement will work just fine.
> >
> > I have also tried to send in the complete datetime format in the query
> > (hh:mm:sec) with no success, the date sent in is the value of the date
> > returned by Axapta without the date column in the where section.
> >
> > Here are my statements.
> >
> > X++, nothing found
> > SELECT * from %1
> > where %1.ACCOUNTCODE == 0
> > && %1.ACCOUNTRELATION == '2423'
> > && %1.ITEMCODE == 0
> > && %1.FROMDATE == '2004-03-01'
> > && %1.RELATION == 0
> > && %1.MODULE == 2
> > && %1.ITEMRELATION == '4660204'
> >
> >
> > SQL, rec found, this works fine
> > SELECT *
> > FROM PRICEDISCTABLE
> > WHERE (ACCOUNTCODE = 0)
> > AND (ACCOUNTRELATION = '2423')
> > AND (ITEMCODE = 0)
> > AND (FROMDATE = '2004-03-01')
> > AND (RELATION = 0)
> > AND ([MODULE] = 2)
> > AND (ITEMRELATION = '4660204')
> >
> > This is driving me nuts, of course i understand that there must be some kind
> > of kernel date format to use, but what format, i can't find anything, any
> > suggestions are welcome.
> >
> > Regards, from a ex Movex IRD guy