L
localhost
I am trying to get table data from a MSSQL Function/UDF using the
OleDb provider.
The error message I get is
"The request for procedure 'FuncOne' failed because 'FuncOne' is a
function object."
How can I get a Table-value return result from MSSQL UDF using OleDb?
Thanks.
try
{
// ... this.connection is open ...
OleDbCommand cmd = new OleDbCommand( "FuncOne" ,
this.connection );
cmd.CommandType = CommandType.StoredProcedure;
OleDbParameter pA = funcCommand.Parameters.Add( "@pA",
OleDbType.VarChar , 8000 );
pA.Value = "A";
pA.Direction = ParameterDirection.Input;
cmd.Parameters.Add( pA );
OleDbParameter pB = funcCommand.Parameters.Add( "@pB",
OleDbType.VarChar , 8000 );
pB.Value = "B";
pB.Direction = ParameterDirection.Input;
cmd.Parameters.Add( pB );
}
this.ResultSet.Tables.Add( new DataTable("test") );
OleDbDataAdapter odda = new OleDbDataAdapter( cmd );
odda.Fill( this.ResultSet.Tables[functionname] );
}
catch( OleDbException xxxOle )
{
string bang = xxxOle.ToString();
}
catch( Exception xxx )
{
string help = xxx.ToString();
}
finally
{
}
OleDb provider.
The error message I get is
"The request for procedure 'FuncOne' failed because 'FuncOne' is a
function object."
How can I get a Table-value return result from MSSQL UDF using OleDb?
Thanks.
try
{
// ... this.connection is open ...
OleDbCommand cmd = new OleDbCommand( "FuncOne" ,
this.connection );
cmd.CommandType = CommandType.StoredProcedure;
OleDbParameter pA = funcCommand.Parameters.Add( "@pA",
OleDbType.VarChar , 8000 );
pA.Value = "A";
pA.Direction = ParameterDirection.Input;
cmd.Parameters.Add( pA );
OleDbParameter pB = funcCommand.Parameters.Add( "@pB",
OleDbType.VarChar , 8000 );
pB.Value = "B";
pB.Direction = ParameterDirection.Input;
cmd.Parameters.Add( pB );
}
this.ResultSet.Tables.Add( new DataTable("test") );
OleDbDataAdapter odda = new OleDbDataAdapter( cmd );
odda.Fill( this.ResultSet.Tables[functionname] );
}
catch( OleDbException xxxOle )
{
string bang = xxxOle.ToString();
}
catch( Exception xxx )
{
string help = xxx.ToString();
}
finally
{
}