Hey
I'm working on an application that generates certain reports based on data from my clients database. In this database, there are stored procedures whose purpose is to get the necessary data from the database (the queries are very complex and it would be very unpractical to use them as SQLCommands in C#). The problem I'm having is that I can't trigger the stored procedure from my application.
When I try to trigger it directly from code:
sp_AP.CommandText = "EXEC sp_AP"; // I've tried both with and without EXEC command
sp_AP.Parameters.Add(new SqlParameter("@parm1",parm1));
sp_AP.Connection = connection;
SDA.Fill(dtMyDataTable); //SDA is a SqlDataAdapter defined globally
When I execute this code I get the exception "No mapping exists from object type System.Data.DataRow[] to a known managed provider native type.".
When I try to create the new TableAdapter visually in my DataSet, I get the "Invalid object name '#table1'". This part is particularly confusing because when I execute the stored procedure directly on the database it works perfectly.
I've never used stored procedures in my applications before, so please follow any answer with code samples.
Thank you.
Loading
Vidya Vrat AgarwalPosted Dec 17, 2012, 4:49 AM
See this URL,
http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/385e6778-a11d-4f90-a378-02e658776bd9/
and if the problem is similar like yours then you may need to do a small prototype at your end(trying # and ##) and if that works, you build a case for your client DBA to change the table names.
Many times it happen that we suggest changes to client schema in order to achieve business functioanlity, as at their design time they can't anticipate all the technical glitches.
Neven DraskovicPosted Dec 17, 2012, 4:25 AM
Neven DraskovicPosted Dec 17, 2012, 3:59 AM
Vidya Vrat AgarwalPosted Dec 17, 2012, 3:52 AM
Thanks
Satyapriya NayakPosted Dec 17, 2012, 3:49 AM