Last post Jan 12, 2010 06:36 AM by Haansi
Jan 12, 2010 03:37 AM|Haansi|LINK
thanks for your attention and time, I need your help plz on writing DAAB code.
I am new to using DAAB, I found two ways to using it:
1. Using IDataReader with DBCommand and Database (db) class like:
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);
db.AddInParameter(dbCommand, “EmployeeID”, DbType.Int32, 1);
db.AddOutParameter(dbCommand, “NationalIDNumber”, DbType.String, 15);
2. Using IDataReader without using DBCommand but with using Database class.
Using 1st way we have to put parameters one by one but by using way 2 allow without declaring parameters like:
Way 2 is good as it give flexibility not to declare parameters but I am not getting how to get output parameter from it ? Please guide me on that.
<input id="gwProxy" type="hidden"><input onclick="jsCall();" id="jsProxy" type="hidden">
Jan 12, 2010 05:25 AM|mudassarkhan|LINK
In way 1
after ExecuteNonQuery write the following to get parameter value
string id = db.GetParameterValue(dbCommand, "NationalIDNumber").ToString();
Jan 12, 2010 06:15 AM|Haansi|LINK
Actually I am using way 2 as in this way save many line of codes to be written for declaring parameters. e.g:
Here can we get a output parameter from stored procedure ?
Jan 12, 2010 06:27 AM|mudassarkhan|LINK
I have not tried the second way but The code I gave you should work here also
Jan 12, 2010 06:36 AM|Haansi|LINK
thanks for sparing time and sharing,
actually it does not work as in this way we do not use DBCommand and your suggested way require dbCommand.
thanks for attending
if any one has its solution plz share.