Monday, 14 May 2012

SPDG v2

Created an improved version of the SPDG

functionality added

  • added returning of SqlDataReader
  • added support for stored procedure output parameters
  • added support for stored procedure "metadata"
  • corrected datamappings to .net
  • backward compatibility with version 1

The "settings" for the app can also be done within the stored procedures via "metadata" to indicate functions to be exposed. To make use of this functionality, add the following code anywhere within the stored procedures; the app will make use of regular expressions to detect the "metadata"

/*[SPDG]Skip,ExecuteDataSet,ExecuteDataReader,ExecuteXML,ExecuteNonQuery,ExecuteScalar*/
 OR
 /*[SPDG]ExecuteNonQuery*/
 OR
 /*[SPDG]Skip*/ - to be exclude in class generation 

Only include the functionality you would like to expose for the particular stored procedure. if no "metadata" is included, the app will leave the options for you to fill in.

I've also included support for accessing output parameters from stored procedures. The output will be stored in the public properties of the stored procedure classes.

accessing of the return value from the stored procedure output can be retrieved using the stored procedure class properties

sp_getbinary sp = new sp_getbinary(new byte[50]);
sp.ExecuteNonQuery();
foreach (byte b in sp.dataout)
{
    lResult.Text += b.ToString();
}
lResult.Text += "\n";
sp_getntext nt = new sp_getntext(new string(' ', 4000));
nt.ExecuteNonQuery();
lResult.Text += nt.dataout;

you can download the full source code from Code Project

No comments:

Post a Comment