we have problems executing stored procedure which contains parameters with "date" data type.
The error says that "is not possible to cast SQL_Variant to DATE and CONVERT function must be used".
the problem is that we must, necessarily, use the prepare statement to retrieve parameters and, such parameters, are returned as "string" data type instead of a date one.
we're using sql connect for sql server pro V2.60.760 and SQL server express 2008.
here's the code we used to notice this behaviour:
Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Devart.Common;
using Devart.Data.SqlServer;
using System.Data;
namespace test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnection _Connection = new SqlConnection("Server=DBISTANCE;Database=Test;User Id=TestSQL;Password=test;");
DbCommandBase myCommand = null;
myCommand = new SqlCommand("sp_TestDate", (SqlConnection)_Connection);
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.ParameterCheck = true;
_Connection.Open();
myCommand.Prepare();
foreach (SqlParameter par in myCommand.Parameters)
{
SqlType t = par.SqlType; //String datatype?!?
}
}
}
}
thanks in advance for your help
Fulvio
Edit: sql connect for sql server pro V2.60.769