Friday, March 30, 2012

okay, I thought I had the return value from a statement figured out...

So, Jimmy G helped me out with it in showing a little bit how to do it.
SqlCommand command = new SqlCommand(, object>)SqlParameter param = new SqlParameter();param.ParameterName ="@.return";param.Direction = ParameterDirection.ReturnValue;command.Parameters.Add(param);command.ExecuteNonQuery();//get the return valueint val = int.Parse(command.Parameters[0].ToString());
 
 

Where I get lost is in the declaring of a new sqlcommand and sqlparameter. Can you please spell out where to use this and if I need to change my SQLdataSource. I currently was trying to use it in the OnClick of a button. What I had did the following

Protected Sub CreateIssue_Click(ByVal sender As Object, ByVal e As System.EventArgs)
dim returnValue as integer

'how do I get a return value from the stored procedure executed in 'insertissue.insert() here to a variable?

InsertIssue.Insert()

Response.Redirect("/addarticletoissue")


End Sub

again, thank you for your help and patience with such a beginner =)

I haven't seen your original post where jimmyg helped you out, so I am going to guess that you are trying to retrieve the autoincrement identity value of a newly added record from a SqlDataSource Try the approach detailed here:http://www.mikesdotnetting.com/Article.aspx?ArticleID=54 about 2/3rds of the way down.


|||

ahh! thank you so very much. This helps a ton!

No comments:

Post a Comment