Stored Procedure Problem


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Glad you got it figured out Smile
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
I ended up putting the Select in the sproc and use the filldatatable(cmd). Works great. Thanks for the input.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I would really have to take a look at ths SPROC to give you a more definite answer.  It looks like you are calling the scalar first which would return a single value then calling a fill which would return a result set.  This would ultimately be 2 result sets when coming from a single SPROC.  My rule of thumb is the fewer trips that you make to the server the better off....so if you could do this in a single SPROC, you would be better off.  But like I said, I would have to have a slightly better grasp of what you are trying to do.  Your logic will most likely work just fine for the long term, but if you could consolidate this into a single trip, that never hurts! Smile
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
I solved my problem but I am not sure I did it correctly so if someone could let me know what the correct way to do this is or if there is a better way.



I used the following:

Me.ExecuteScalar(cmd)

Me.FillDataTable("Select * from TimesPointsTempAverage")



TIA.
Terry Bottorff
Terry Bottorff
Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)Advanced StrataFrame User (770 reputation)
Group: Forum Members
Posts: 448, Visits: 12K
I have a Stored Proc that works fine from SSMS. In general this is what the Stored Proc looks like:

1. Deletes data in Table A.

2. Inserts data in Table A with an Insert ... Select ...

3. Deletes data in Table B.

4. With a Parameter it Inserts Data in Table B with an Insert ... Select ...



The Data in Table B is from Table A using a Group By. The BO is based on Table B and remains empty when I try to fill it with the following commands:

Dim cmd As New SqlCommand("sp_gborderbyavegoonegotwo")

cmd.CommandType = CommandType.StoredProcedure

cmd.Parameters.Add("@rodeoid", SqlDbType.Int).Value = nrod

Me.FillDataTable(cmd)



nrod is defined as an integer and has the correct value. Of course I don't know if a stored proc can have multiple statements but since it worked in SSMS I thought it would work with a BO and I tried to find the info on the forum but could not. Thank you for any advise you can give me. If you need more info please let me know. TIA



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search