Showing posts with label standard. Show all posts
Showing posts with label standard. Show all posts

Monday, March 12, 2012

Mysterious Date Problem

Is there a way to either set Sql Server 2000 or ASP.net datetime fields to a standard format. The problem is that I am passing correct datetime fields using stored procedures and keep getting "Cannot convert datetime into string". It seems to me that many other developers are having that same problem. I tried alot of different methods and still have the same problem. I'm using c# and I never had a problem with datetime fields when I was using vb.net. The problem is that SQl Server is returning datetime formats that are not compatible with c#. I have code that works in other projects but when I try to use that same code I get that conversion error. How do I set the datetime in SQl Server and ASP.Net when I run queries so that the datetime output is in mm/dd/yyyy?What is the statement where you get the error "Cannot convert datetime into string"|||well anytime I return a dataset and bind it to a datagrid I get a conversion error. Sometimes I even got 'The conversion of a char data type to a datetime data type resulted in an out-of-range'. When I ran a simple query in Query Analyzer like "select convert (datetime,'12/20/2003',101)" the output returns 2003-12-20 00:00:00.000
What I need is to be mm/dd/yyyy. Is there a way to change the default setting in Sql Server to that particular format instead of yyyy-mm-dd. Because I think C# is using mm-dd-yyyy as a default. In the asp net datagrid all I'm doing it just binding the dataset to the grid and I get that error? Thanks for your reply...|||you should do the formatting at the front end...for instance when you bind the result set to the datagrid...you can use the dataformatstring property of the datagrid columns to format it to mm/dd/yyyy format which is much simpler rather than enforcing the sql server to some other format..

hth|||Yah, I used that format and that is not the problem. The problem is that I can't even bind the dataset to the datagrid. Its in the binding that is causing the error. But thanks anyway.|||What is the code that you are using??|||basically I just call pass parameters to a method and it returns a dataset

datagrid.DataSource = ds;
datagrid.DataBind();

public DataSet GetOriginationReport( DateTime dtStartDate, DateTime dtEndDate)
{
// instantiate connection and command objects
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["connString2"]);
SqlDataAdapter myCommand = new SqlDataAdapter("rptSelectReport", myConnection);
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure;

myCommand.SelectCommand.Parameters.Add("@.pStartDate", SqlDbType.DateTime );
myCommand.SelectCommand.Parameters.Add("@.pEndDate", SqlDbType.DateTime );

myCommand.SelectCommand.Parameters["@.pStartDate"].Value = dtStartDate;
myCommand.SelectCommand.Parameters["@.pEndDate"].Value = dtEndDate;

DataSet myDS = new DataSet();
myCommand.Fill(myDS,"viewReportPipe");
return myDS;
}

===============================
Stored Procedure
===============================
CREATE PROCEDURE rptSelectReport
(
@.pStartDate DateTime,
@.pEndDate DateTime,
)
As

Select * from viewReportPipe Where AppDate Between @.pStartDate And @.pEndDate|||What result do u get when u run this query in Sql analyzer??
Select * from viewReportPipe Where AppDate Between @.pStartDate And @.pEndDate|||well I get a list of results. The problem is occuring in the binding. When I run the query and bind it to a datagrid it works. But I have sorting enable in the datagrid and when I run that same query and bind it to the grid it fails and gives me that "Cannot convert datetime to string" error. The datefield in the table is "AppDate" and is a datetime datatype and is not null. I know Sequel stores dates internally and is different then what is displayed. I have dates 01/01/1900 as default dates. I just discover that sequel uses that same date as a default date. To me its seems like Sequel is switching datetime formats and C# is not recognizing it as a valid datetime. Thanks for you quick response...|||Also should I changed my select statement and convert the date in the stored procedure
like "select AppDate = convert(datetime,AppDate) from ...|||What value does dtStartDate have??|||dtStartDate has 12/01/2003 12:00:00 AM

and the dtEndDate has 12/31/2003 12:00:00 AM|||I am not sure why you get error??
Cannot convert datetime to string

It must be probably your sorting procedure handling some parameter in wrong manner|||its funny because that what I originally though. I was able to sort by a few columns and it works. But some columns would throw that conversion error. I know I am sorting by the right field name but for some reason and I don't why but Sequel is switching datetime formats. That leads me to my original question that Sequel is returning the recordset as yyyy-mm-dd and and is there a way to change it to mm-dd-yyyy. I notice that other developers are experience the same problem and the answer seems to be that SQl Server and asp.net application have to have the same regional setting(datetime). But I haven't found an answer to change the setting in SQL Server or asp.net application. I know how to change the settings on the server but that doesn't help.|||Post your Sorting code...

Friday, March 9, 2012

MySAP Business Suite ERROR: Table class INTTAB is not supported.

Hi there,

we collect data from SAP via the Data Provider for MySAP Business Suite.
Everything works fine for Standard objects like KNA1 etc. but if we try to read data from a custom table we get the following error:

Code Snippet

Fehler bei Get ZZEUSGRP_WA [SAP ZZEUSGRP_WA [1]]: Microsoft.Adapter.SAP.SAPManagedProviderException: Table class INTTAB is not supported.
bei Microsoft.Adapter.SAP.SAPSelectHandler.CheckResult(SAPTable returnTab)
bei Microsoft.Adapter.SAP.SAPSelectHandler.ExecuteSelect(SAPTable tabFields, SAPTable tabStruct_Tab....


The error message tells me not to use a specific table type. So far so good.
The question is: What would be the workaround? What should I tell the SAP team who cares for the data structures?

Thank you for your advice in advance
Fridtjof

OK, the reason for this problem is: The referenced SAP object is a view which is currently not supported by the connector.
(That doesn't really anser my question but nevertheless it is not a bug)

Fridtjof

Monday, February 20, 2012

My host runs SQL Server 2000, i have SQL Server 2005. What to do?

Hi,

the title of this topic about summarises it. I have a dev-machine with SQL Server 2005 Standard edition on it. My host runs SQL Server 2000. What are my options?

Is there some sort of backward compatibility? Can i export as 2000?

I have no idea and i can't find anything about this particular problem.

Thanks

2 solutions:

Move your database to SQL Server 2000 or|||

The possibility to script the database/objects makes it rather easy to generate a script in SQL 2005 and run the script in SQL 2000 Query Analyzer.

There is a feature (dropdownbox) that is named : Script for version.

If you select SQL Server 2000, you'll eliminate many of the SQL 2005 specific commands.

Clientwise... You have to use the SQL provider, I don't think the NAtive provider for 2005 works with 2000 (please feel free to prove me wrong on this...)

/micke

|||The main difference SQL Server 2000 uses TDS(tabular data stream) 80 while SQL Server 2005 uses TDS 90 but SQL Server 2005 also require file groups in the create table statement, so you can create a blank database in SQL Server 2000 and do INSERT INTO with column list per table which gives you control of the insert. The other alternative is to look for SQL Server 2005 hosting provider. Hope this helps.