Problem Passing from asp.net to stored procedure

Posted on 2008-11-19
Medium Priority
Last Modified: 2012-05-05
Below is the code I was trying to use to insert into a table in MS SQL server.  The host doesn't allow partially trusted connections though so this will not work.  I wanted to change the code to work with a stored procedure that I have written but I'm unfamiliar with .net.  The below code I made in dreamweaver with a server behavior.
<%@ Page Language="VB" ContentType="text/html" %>
<%@ Register TagPrefix="MM" Namespace="DreamweaverCtrls" Assembly="DreamweaverCtrls,version=,publicKeyToken=836f606ede05d46a,culture=neutral" %>
CommandText='<%# "INSERT INTO dbo.Splash (name, zip, interest, ft, pt, interestlvl1, interestlvl2, interestlvl3, ""check"", phone, email) VALUES (@name, @zip, @interest, @ft, @pt, @interestlvl1, @interestlvl2, @interestlvl3, @check, @phone, @email)" %>'
ConnectionString='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_STRING_nathan") %>'
DatabaseType='<%# System.Configuration.ConfigurationSettings.AppSettings("MM_CONNECTION_DATABASETYPE_nathan") %>'
Expression='<%# Request.Form("MM_insert") = "signup" %>'
SuccessURL='<%# "technology.html" %>'
FailureURL='<%# "Health.html" %>'
    <Parameter Name="@name" Value='<%# IIf((Request.Form("name") <> Nothing), Request.Form("name"), "") %>' Type="VarChar" />
    <Parameter Name="@zip" Value='<%# IIf((Request.Form("zip") <> Nothing), Request.Form("zip"), "") %>' Type="VarChar" />
    <Parameter Name="@interest" Value='<%# IIf((Request.Form("interest") <> Nothing), Request.Form("interest"), "") %>' Type="VarChar" />
    <Parameter Name="@ft" Value='<%# IIf((Request.Form("ft") <> Nothing), Request.Form("ft"), "") %>' Type="VarChar" />
    <Parameter Name="@pt" Value='<%# IIf((Request.Form("pt") <> Nothing), Request.Form("pt"), "") %>' Type="VarChar" />
    <Parameter Name="@interestlvl1" Value='<%# IIf((Request.Form("radiosite1") <> Nothing), Request.Form("radiosite1"), "") %>' Type="VarChar" />
    <Parameter Name="@interestlvl2" Value='<%# IIf((Request.Form("radiosite2") <> Nothing), Request.Form("radiosite2"), "") %>' Type="VarChar" />
    <Parameter Name="@interestlvl3" Value='<%# IIf((Request.Form("radiosite3") <> Nothing), Request.Form("radiosite3"), "") %>' Type="VarChar" />
    <Parameter Name="@check" Value='<%# IIf((Request.Form("check") <> Nothing), Request.Form("check"), "") %>' Type="VarChar" />
    <Parameter Name="@phone" Value='<%# IIf((Request.Form("phone") <> Nothing), Request.Form("phone"), "") %>' Type="VarChar" />
    <Parameter Name="@email" Value='<%# IIf((Request.Form("email") <> Nothing), Request.Form("email"), "") %>' Type="VarChar" />
<MM:PageBind runat="server" PostBackBind="true" />

Open in new window

Question by:Nathan Riley
  • 2
  • 2

Expert Comment

ID: 22995240
Do you have Visual Studio? The wizard is very easy to follow and you can specify the controls directly that link to the variables in your stored procedure.

This link may help you understand a bit better: http://www.aspnettutorials.com/tutorials/database/storedprocedure-vb.aspx
LVL 12

Author Comment

by:Nathan Riley
ID: 22995467
Visual Web Developer? Yes I have it but not familiar with the functions.  How would I do it?

Accepted Solution

Reecio earned 2000 total points
ID: 23011495
When you add an SqlDataSource you just hover over the control (In design view) and a right arrow will appear.
Click this and select configure data source, a wizard will appear asking you to select the connection string (There will automatically be options on the pulldown if you have specified this in the web.config)

Once you've selected the appropriate connection string, hit next and you'll be presented with the query builder. There is an option there to specify your own query or used a stored procedure, select this and hit next.
You should be able to pick from a list of stored procedures found on your server from the stored procedures pull down list. If the stored procedures check box is not selectable, check the security level of your log in ID, if it has permission for stored procedures they will be shown.
LVL 12

Author Comment

by:Nathan Riley
ID: 23016373
Ah yeah I see that now.  Still having some issues though.  What's the best way to do this?  On my index.aspx page I have a form.  After filled out and hit submit it takes me to robot.aspx page with all the values from the previous form showing up in the address bar.  How would I collect them from there?  Do  I need to add the sqldatasource on that page to grab them?  Or do I need it on index.aspx so it will collect when they hit submit.  I have tried but now seeming to work.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses
Course of the Month15 days, 20 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question