A
arun gunda
I am trying to create a webservice for executing a stored
procedure. This webservice is just a wrapper class for
Microsoft.ApplicationBlocks.Data Functions. I will pass
the database name, stored procedure name and sql parameter
object. I am able to create webservice I mentioned below,
but It only works from .Net C# Windows Form but when I try
to use it from ASP.Net c#, I am unable to compile. it
looks like it is unable to resolve namespace for
sqlparameter
Any ideas why this happens?
[WebMethod]
public System.Data.DataSet ExecuteSP(string databasename,
string spname, params System.Data.SqlClient.SqlParameter[]
commandParameters)
{
System.Data.DataSet ds;
//read database connection string
string connectstring = Application[databasename].ToString
();
// SqlConnection that will be used to execute the sql
commands
SqlConnection connection = null;
try
{
connection = new SqlConnection(connectstring);
//Open Connection
connection.Open();
ds = SqlHelper.ExecuteDataset(connection,
CommandType.StoredProcedure, spname, commandParameters);
}
catch(Exception ex)
{
throw ex;
}
finally
{
if(connection != null)
connection.Dispose();
}
return ds;
}
}
procedure. This webservice is just a wrapper class for
Microsoft.ApplicationBlocks.Data Functions. I will pass
the database name, stored procedure name and sql parameter
object. I am able to create webservice I mentioned below,
but It only works from .Net C# Windows Form but when I try
to use it from ASP.Net c#, I am unable to compile. it
looks like it is unable to resolve namespace for
sqlparameter
Any ideas why this happens?
[WebMethod]
public System.Data.DataSet ExecuteSP(string databasename,
string spname, params System.Data.SqlClient.SqlParameter[]
commandParameters)
{
System.Data.DataSet ds;
//read database connection string
string connectstring = Application[databasename].ToString
();
// SqlConnection that will be used to execute the sql
commands
SqlConnection connection = null;
try
{
connection = new SqlConnection(connectstring);
//Open Connection
connection.Open();
ds = SqlHelper.ExecuteDataset(connection,
CommandType.StoredProcedure, spname, commandParameters);
}
catch(Exception ex)
{
throw ex;
}
finally
{
if(connection != null)
connection.Dispose();
}
return ds;
}
}