Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 14th, 2006, 10:50 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Stored Procedure Problems


OK, so this is going to be a really dumb question, but for some reason I can't find the answer anywhere.

I have a MsSql 2005 server and ASP.net 2.0. I have an account that has view permissions on Views, and execute permissions on stored procedures and no other access. I have a detailsview read in from the view, and I want to use the stored procedures to add/update/delete from the database, since the account that connects to the server doesn't have permissions.

When I try and set the stored procedure, it doesn't want to pass the parameters to it. I have it set up in the SqlDataSource declaration in the asp page, but I can't seem to find the proper method to bind the detailsview data to the stored procedure parameters.

Any suggestions?
Reply With Quote
  #2 (permalink)  
Old March 15th, 2006, 01:10 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

What do you mean by this:?
Quote:
quote:
When I try and set the stored procedure, it doesn't want to pass the parameters to it. I have it set up in the SqlDataSource declaration in the asp page, but I can't seem to find the proper method to bind the detailsview data to the stored procedure parameters.
When you go through setting up the sqldatasource, you have to tell it where the parameters are coming from.

Jim


Reply With Quote
  #3 (permalink)  
Old March 15th, 2006, 09:20 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When I set up the sqldatasource, it doesn't give me paramater options for the update/insert/delete stored procedures. It does give me options for the select statement, which is a view, not a stored procedure.

I attempted to put the parameters in myself inside the sqldatasource declaration, but I think I did it wrong:

Code:
    <asp:SqlDataSource
        ID="sdsTrainingClassLocations" 
        runat="server" 
        ConnectionString="<%$ ConnectionStrings:LocalDev %>"
        ProviderName="<%$ ConnectionStrings:LocalDev.ProviderName %>" 
        SelectCommandType="Text"
        SelectCommand="SELECT * FROM [vwTrainingClassLocations] WHERE ([Id] = ?)"
        UpdateCommandType="StoredProcedure" 
        UpdateCommand="sp_TrainingClassLocations_Update" 
        DeleteCommandType="StoredProcedure" 
        DeleteCommand="sp_TrainingClassLocations_Delete" 
        InsertCommandType="StoredProcedure" 
        InsertCommand="sp_TrainingClassLocations_Insert" >
        <SelectParameters>
            <asp:SessionParameter DefaultValue="0" Name="Id" SessionField="TCL_Id" Type="Int64" />
        </SelectParameters>
        <UpdateParameters>
            <asp:ControlParameter ControlID="dvTrainingClassLocations" Name="Id" PropertyName="Id" Type="Int64" />
            <asp:Parameter Name="Address1" Type="String" />
            <asp:Parameter Name="Address2" Type="String" />
            <asp:Parameter Name="City" Type="String" />
            <asp:Parameter Name="StateId" Type="Int64" />
            <asp:Parameter Name="ZipCode" Type="String" />
            <asp:Parameter Name="Phone" Type="String" />
        </UpdateParameters>
        <DeleteParameters>
            <asp:Parameter Name="intId" Type="Int64" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="@Address1" Type="String" />
            <asp:Parameter Name="@Address2" Type="String" />
            <asp:Parameter Name="@City" Type="String" />
            <asp:Parameter Name="@StateId" Type="Int64" />
            <asp:Parameter Name="@Zipcode" Type="String" />
            <asp:Parameter Name="@Phone" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
Reply With Quote
  #4 (permalink)  
Old March 15th, 2006, 10:48 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oh, and I know I don't have some @'s in there before names, I have been doing tryial-and-error coding to try and get this monster to work.
Reply With Quote
  #5 (permalink)  
Old March 15th, 2006, 10:48 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I am not sure what the problem is. The only thing I can think of is that you are using mySQL and that is causing some sort of issue. If you can, download SQLExpress, it's free and will integrate better with VS2005.

Reply With Quote
  #6 (permalink)  
Old March 15th, 2006, 10:57 AM
Registered User
 
Join Date: Mar 2006
Location: , , .
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using MsSql 2005, as I mentioned in my first post. I'm just having trouble telling sqldatasource which dataview columns go with each stored procedure parameter.
Reply With Quote
  #7 (permalink)  
Old March 24th, 2006, 05:28 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

my sql uses "?"s i believe

Reply With Quote
  #8 (permalink)  
Old May 23rd, 2006, 11:34 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Tarcash...Did you ever find an answer to your question, I'm having the same problem!
Reply With Quote
  #9 (permalink)  
Old June 16th, 2006, 11:19 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

select the parameter option BEFORE you select the insert tab or any other tab on the screen you are talking about.
Then select the tab and you will have the option of clicking next then.

It is a bug...

Reply With Quote
  #10 (permalink)  
Old June 19th, 2007, 07:24 PM
Registered User
 
Join Date: Apr 2007
Location: , NJ, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
can you please explain this..
I have the same issues,
what to click first and what to next!!
it's confusing...

thanks
Deepak

Deepak Palkar
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stored Procedure Help BukovanJ SQL Language 2 October 10th, 2006 08:02 AM
Problems returning count in Stored Procedure planza SQL Language 1 December 21st, 2005 03:24 PM
stored procedure lokey VB How-To 7 June 30th, 2005 12:37 AM
Biztalk Stored Procedure problems with NULL value mtlili Biztalk 0 September 21st, 2004 05:32 AM
Stored Procedure Problems addersting SQL Language 2 October 27th, 2003 11:48 AM



All times are GMT -4. The time now is 09:19 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.